Managing
system services with systemd107
Figure 4.1 – chronyd.service contents
This file defines not only the traditional program to start and the
process identifier (
PID) file, but the dependencies, conflicts,
and soft dependencies, which provides enough information to systemd to decide on the right approach.
If you’re familiar with INI files, this file uses that approach, in
that it uses square brackets, [ and ], for sections and then pairs of key=value for the settings in each section.
Section names are case-sensitive, so they will not be interpreted correctly if the proper naming convention is not used.
Section directives are named like so Unit [Install]
There are additional entries for each of the different types, as follows Service Socket Mount [Automount]
Tools for Regular Operations Swap Path Timer [Slice]
As you can see, we have specific sections for each type. If we execute man systemd.unit,
it will give you examples, along with all the supported values, for the systemd version you’re using, as illustrated in the following screenshot:
Figure 4.2 – Manual (man) page of systemd.unit
With that, we have reviewed the file structure of unit files. Now, let’s use systemctl to actually manage the service’s status.
Share with your friends: