Systemd unit files
These are the notes of a training course on systemd I gave as part of my work with Truelite.
For reference, the global index with all
.unit file directives is at
All unit files have a
[Unit] section with documentation and dependencies. See
It is worth having a look at existing units to see what they are like. Use
systemctl --all -t unittype for a list, and
systemctl cat unitname to see
its content wherever it is installed.
systemctl cat graphical.target. Note that
systemctl cat adds a
line of comment at the top so one can see where the unit file is installed.
Most unit files also have an
[Install] section (also documented in
that controls what happens when enabling or disabling the unit.
.target units only contain
[Install] sections, and can be used
to give a name to a given set of dependencies.
For example, one could create a
remote-maintenance.target unit, that when
brought up activates, via dependencies, a set of services, mounts, network
sockets, and so on.
systemctl --all -t target for examples.
has a list of units names that have a standard use associated to them.
ctrl-alt-del.target is a unit that is started whenever
Control+Alt+Del is pressed on the console. By default it is symlinked to
reboot.target, and you can provide your own version in
to perform another action when Control+Alt+Del is pressed.
systemd can also be used to manage services on a user session, starting them at login and stopping them at logout.
--user to the normal systemd commands to have them work with the current
user's session instead of the general system.
See systemd/User in the Arch Wiki for a good description of what it can do.