grimoire

personal wiki
git clone git://git.pyratebeard.net/grimoire.git
Log | Files | Refs

commit f405994fd1935780f0c14eb81850e3360feb003a
parent 4f0d3f356375b674b18b8666b74249c252a5de8c
Author: pyratebeard <root@pyratebeard.net>
Date:   Fri, 22 Feb 2019 12:30:02 +0000

updated with user service information

Diffstat:
Mtechnology/linux/general/systemctl.md | 37++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/technology/linux/general/systemctl.md b/technology/linux/general/systemctl.md @@ -1,5 +1,7 @@ # systemctl +also see [journalctl](journalctl) + ```bash systemctl list-units [ --all | --type=service ] ``` @@ -9,13 +11,38 @@ systemctl list-units [ --all | --type=service ] systemctl list-unit-files ``` -## create service file +#### create service file ``` vi /etc/systemd/system/<name>.service ``` -[journalctl](journalctl) +([manage systemd][]) + +## user services +run `systemctl` (without sudo) and with the `--user` option + +service files are created under '$HOME/.config/systemd/user' + +### example user service file +``` +[Unit] +Description=This is an example + +[Service] +ExecStart=/path/to/command + +[Install] +WantedBy=default.target +``` +([writing user units][]) + +enable and start the user service (without sudo) +``` +systemctl --user enable <service> +systemctl --user start <service> +systemctl --user status <service> +``` + -## ref -- :1: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units -- https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units +[manage systemd]: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units +[writing user units]: https://wiki.archlinux.org/index.php/Systemd/User#Writing_user_units