systemd


Author: yifei / Created: June 26, 2017, 9:07 p.m. / Modified: June 27, 2017, 2:40 a.m. / Edit

basic usage

systemctl start/stop/reload/restart/reload-or-restart/enable/disable/cat/list-dependencies app[.service]

systemctl is-enabled/is-active/is-failed app.service

enable copies a symlink from /etc/systemd/system/*.service to systemd's direcotry

systemctl list-units/list-unit-files/daemon-reload

service vs target

unit files

locations

/usr/lib/systemd/system/: units provided by installed packages /etc/systemd/system/: units installed by the system administrator

dependency

In that case add Requires=B and After=B to the [Unit] section of A. If the dependency is optional, add Wants=B and After=B instead. Note that Wants= and Requires= do not imply After=, meaning that if After= is not specified, the two units will be started in parallel.

type

Type: simple/ forking

edit

systemctl edit will edit an override file, systemctl edit --all will edit the file.

ExecStart

if you service depends on another service, use requires= + after= or wants= + after=


评论区