Pcornel
Linux · systemd & Services

start / stop / restart

Cheat sheet · https://pcornel.dk/topic.php?topic=2725

Back to the Topic

Answer

systemctl start, stop, restart and reload control a running unit; reload re-reads configuration without stopping the process (if the service supports it); try-restart restarts only if running.

Remember

Test the configuration before restarting (e.g. nginx -t) to avoid taking the service down. Prefer reload where supported to keep connections. Check status and logs after every restart.

First checks

  • systemctl status <unit> — state, main PID, recent log lines
  • systemctl list-units --failed — failed units
  • journalctl -u <unit> -b — the unit's log since boot
  • systemctl cat <unit> — unit file plus drop-ins
  • systemd-analyze verify <unit> — unit file errors

Verify in this order

config validated → reload or restart → new process or re-read config → active → functional test

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=2725

Confirmation

Confirm action

Continue?