Overview
Last edited
What is systemd?
Pithy
systemdis a Linux init system and service manager that starts services and keeps them alive under a unified dependency and logging framework.
Overview
Question
What’s the point, why not just use shell scripts to start everything?
Answer
Shell scripts don’t scale, there’s no standard way to handle logging, restarts, dependencies, or resource limits across every service.
- systemd defines the schema (vocabulary) - what keys are valid, what values they accept, what they do. e.g.
SuccessExitStatus=,Restart=- the unit file author fills it in - picking only the keys relevant to their service, leaving the rest at their defaults. e.g.
SuccessExitStatus=DATAERR,Restart=on-failure- it also allows services to be managed through one interface
systemctlThis way each unit has a standardized way to control their service without having to rewrite the same logic in shell - things like logging, restart behavior, dependency ordering, resource limits and exit code handling are all handled by systemd uniformly.
Instead of every service author writing their own daemonizing and logging code, they just declareType=forkingorStandardOutput=journaland systemd handles it.
Question
Daemons?
Answer
Originally: from Greek/Latin concept “a supernatural being of a nature intermediate between that of gods and men or a guiding spirit”.
Then: borrowed by physicist James Maxwell for a thought experiment: an imaginary agent silently sorting gas molecules by speed.
Now: it means an invisible background processes.