Lesson 1.13: Unit files and drop-ins
Every service on a modern Linux system is described by a systemd unit file. Packages install theirs under /usr/lib/systemd/system, and an upgrade may replace them, so administrators never edit those files: they add drop-ins, small files in /etc/systemd/system/<unit>.d/ that override single settings. systemd reads the files only when told to (daemon-reload), so a change on disk isn't a change in effect until then. In the lab you read the shop API's unit, see where its settings come from, add a drop-in that makes it restart always, notice that nothing changed yet, and reload.
16 min
You will learn to
- Read a unit file and its sections
- Find where a unit's settings come from
- Override settings with a drop-in
- Explain why daemon-reload is needed
- Check the effective configuration with systemctl show
Key terms
- Unit file
- A file describing one thing systemd manages: a service, timer, socket, mount and more.
- Drop-in
- A .conf file in <unit>.d/ that overrides or adds settings to a unit.
- /usr/lib vs /etc
- Vendor units live in /usr/lib/systemd/system; local units and overrides in /etc/systemd/system, which wins.
- daemon-reload
- Tells systemd to re-read all unit files.
- Restart=
- When systemd restarts a service that stopped: no, on-failure, always…
← What is Linux? · All lessons · Reading a process through /proc →