# simple list
journalctl -u mikroserver -o cat
# reversed
journalctl -u mikroserver -o cat -r
# interactive
journalctl -u mikroserver -o cat -f
Last active
March 21, 2020 04:29
-
-
Save iyusa/827069c08d8c80ef627b828868515233 to your computer and use it in GitHub Desktop.
[SystemD] #linux #systemd #local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/lib/systemd/system/logserver.service | |
# atau di ubuntu: | |
# /lib/systemd/system/logserver.service | |
[Unit] | |
Description=Log server daemon Service | |
After=network.target | |
[Service] | |
PrivateTmp=yes | |
WorkingDirectory=/opt/logserver/ | |
ExecStart=/opt/logserver/logserver.bin | |
Restart=always | |
RestartSec=10s | |
[Install] | |
WantedBy=default.target |
$ mkdir -p ~/.config/systemd/user
# add *.service to that folder
$ systemctl --user daemon-reload
$ systemctl --user start worker # starts the service
$ systemctl --user stop worker # stops the service
$ systemctl --user restart worker # restarts the workers
$ systemctl --user status worker # shows us the service status
# If we want this service to start automatically when our user logs in, we have to enable it:
$ systemctl --user enable worker
$ systemctl --user disable worker
$ journalctl -u worker
# or on older version
$ journalctl --user-unit worker
By default, systemd starts enabled user units when the user logs in, and stops them once the user has logged out
$ sudo loginctl enable-linger USERNAME
# You can check the status for each user by:
$ sudo loginctl user-status USERNAME
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment