grimoire

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

systemd.md (993B)


      1 # systemd
      2 
      3 ## systemctl
      4 
      5 also see [journalctl](/linux/journalctl)
      6 
      7 ```bash
      8 systemctl list-units [ --all | --type=service ]
      9 ```
     10 
     11 - show all enabled and disabled services
     12 ```bash
     13 systemctl list-unit-files
     14 ```
     15 
     16 #### create service file
     17 ```
     18 vi /etc/systemd/system/<name>.service
     19 ```
     20 
     21 ([manage systemd][])
     22 
     23 ## user services
     24 run `systemctl` (without sudo) and with the `--user` option
     25 
     26 service files are created under '$HOME/.config/systemd/user'
     27 
     28 ### example user service file
     29 ```
     30 [Unit]
     31 Description=This is an example
     32 
     33 [Service]
     34 ExecStart=/path/to/command
     35 
     36 [Install]
     37 WantedBy=default.target
     38 ```
     39 ([writing user units][])
     40 
     41 enable and start the user service (without sudo)
     42 ```
     43 systemctl --user enable <service>
     44 systemctl --user start <service>
     45 systemctl --user status <service>
     46 ```
     47 
     48 
     49 [manage systemd]: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
     50 [writing user units]: https://wiki.archlinux.org/index.php/Systemd/User#Writing_user_units