← index

Replacing cron with systemd timers

Cron is fine until a job fails silently. Timers cost more typing and give back logs, ordering and a way to catch up after downtime.

[Unit]
Description=Nightly export

[Timer]
OnCalendar=*-*-* 03:20:00
Persistent=true
RandomizedDelaySec=300

[Install]
WantedBy=timers.target

Persistent=true is the part cron cannot do: if the machine was off at 03:20, the job runs at boot instead of being skipped.

Timer schedule grid
Randomised delay spreads twelve machines across five minutes instead of stampeding at once.

Check what is scheduled with systemctl list-timers --all, and read failures with journalctl -u name.service. That alone was worth the migration.