systemd Essentials
intermediateUnderstand units, write your own service, and control and debug it with systemctl and journalctl.
2 chapters25 min readlinuxsystemdservicesinit
Also available inFrançais
Chapters
Everything to remember
Every chapter's recap, in one place.
Units and unit files
Recap
systemd is PID 1 and manages every service as a unit.
Unit type is determined by the file suffix: .service, .socket, .timer, .target.
Local overrides belong in /etc/systemd/system, never in /usr/lib.
[Unit] sets ordering, [Service] sets how to run, [Install] sets what enables it.
systemctl and journalctl
Recap
daemon-reload after every unit file change, or systemd keeps the stale copy.
enable sets boot behaviour; start affects only the running system.
journalctl -u <unit> -f is the equivalent of tail -f on a service log.
systemctl edit creates a drop-in override and leaves the packaged unit intact.