Pcornel
Automation · Bash Automation

systemd Timers

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

Back to the Topic

Answer

systemd timers schedule services with .timer units using OnCalendar= or OnBootSec=, with logging in journald, Persistent=true for missed runs and dependencies, as a modern alternative to cron.

Remember

  • Pair .timer with .service.
  • OnCalendar= for schedules.
  • Persistent=true catches missed runs.

First checks

  • systemctl list-timers --all — timers
  • systemctl status <name>.timer <name>.service — state
  • journalctl -u <name>.service — run logs

Commands

systemctl enable --now backup.timer
systemctl list-timers
journalctl -u backup.service
systemctl --failed

Verify in this order

timer → service unit → journal

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5290

Confirmation

Confirm action

Continue?