- it is a convention for daemon progams to end in the letter d
- systemctl command is used to manage units e.g. display available units
systemctl -t help
Listing service units
systemctl list-units --type=service [--all]
systemctl list-unit-files --type=service # + installed but not enabled
Viewing service states
systemctl status <name.type>
systemctl status sshd.service
Verifying the status of a service
systemctl is-active sshd.service
... is-enabled ...
... is-failed ...
Service controls
systemctl start ...
systemctl stop ...
systemctl restart ...
systemctl reload ... # just reloads config files without restart. This does not change pid
systemctl reload-or-restart ... # reloads if possible, otherwise restarts
systemctl list-dependencies ... # displays hierarchy mapping
Masking and Unmasking
- This prevents a service from starting by crating a symlink to /dev/null.
systemctl mask ...
systemctl unmask ...
Enabling services to start / stop at boot
-
starting / stopping on a running system does not guarantee that the service auto starts/stops when the system reboots.
-
GRUB2 - GRand Unified Bootloader v2
selecting a target to boot at runtime
# systemctl isolate <target>
# e.g.
systemctl isolate multi-user.target
get and set the default target (persistent)
systemctl get-default
# systemctl set-default <target> e.g.
systemctl set-default multi-user.target # graphical.target
systemctl reboot # reboots to cli interface instead of gui