Services
Cheat sheet · https://pcornel.dk/topic.php?topic=2719
Answer
A systemd service unit (.service) runs and supervises a process: how to start it (ExecStart), as which user, how to restart it, and what it depends on.
Remember
Read the journal, not just status. Common causes: wrong path in ExecStart, missing permissions for User=, a port already in use, a config error (test with the program's own check, e.g. nginx -t). Restart=on-failure hides crashes — check the restart count.
First checks
systemctl show <svc> -p NRestarts— how often it restartedsystemctl status <unit>— state, main PID, recent log linessystemctl list-units --failed— failed unitsjournalctl -u <unit> -b— the unit's log since bootsystemctl cat <unit>— unit file plus drop-inssystemd-analyze verify <unit>— unit file errors
Commands
systemctl is-active <unit>- Returns concise unit active state.
systemctl start
Verify in this order
service started → ExecStart runs as User= → main process stays up → systemd restarts it per policy → logs to the journal
Where it usually breaks
First mismatch in persistent unit/config/generator → dependency/order graph → systemd state → process/cgroup → socket/resource dependency → journal → consumer check; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2719