systemd

systemd #

The service manager on most modern Linux distributions. Systemd is the very first process that starts after the kernel is loaded, and it takes care of starting all other processes and services on a Linux system.

unit #

An item that is managed by Systemd. Different types of units exist:

[root@rocky9 ~]# systemctl -t help
Available unit types:
service
mount
swap
socket
target
device
automount
timer
path
slice
scope

Overview of units #

systemctl Unit Overview Commands

Command Description
systemctl -t service Shows only service units
systemctl list-units -t service Shows all active service units (same as previous command)
systemctl list-units -t service –all Shows all inactive & active service units
systemctl –failed -t service Shows all failed service units
systemctl status -l .service Shows detailed status information about a service

Unit dependencies #

Find out which dependencies a unit has:

systemctl list-dependencies <unitname>

Find out which units are required for this unit to be started:

systemctl list-dependencies <unitname> --reverse
systemctl cat <unitname>

Unit options #

Show available unit options:

systemctl show
# or
systemctl show <unitname>

Editing units #

systemctl edit <unitname>

Reload systemd units #

Reload systemd unit files after editing or making changes:

systemctl daemon-reload

target #

In Systemd, a collection of unit files that can be managed together.

want #

An indication for a Systemd unit file that is supposed to be started from a specific Systemd target.

...
[Install]
WantedBy=multi-user.target

If a service is enabled it’s a symlink in a directory of the target name so that Systemd knows to start the service as part of that group of units.

[root@rocky9 ~]# systemctl enable vsftpd
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service.

In Systemd terminology, this symbolic link is known as a want, as it defines what the target wants to start when it is processed.