Cron · Five fields
Cron vs systemd timers
Cron is one line per job; systemd timers separate a unit from its schedule and can catch up on missed runs.
Key facts
| Cron syntax | Five fields |
|---|---|
| systemd calendar | <code>OnCalendar=*-*-* 09:00:00</code> |
| Timer types | Realtime (OnCalendar) and monotonic (OnBootSec, OnUnitActiveSec) |
| Catch-up | <code>Persistent=true</code> runs a missed calendar job after boot |
| Jitter | <code>RandomizedDelaySec=</code> spreads load |
| Inspection | <code>systemctl list-timers</code> |
| Unit pairing | A .timer activates a matching .service |
What changes when you move a job
A systemd timer is a unit that activates a service, so the command, environment and logging live in the service unit rather than in one crontab line. OnCalendar uses a calendar expression such as Mon..Fri 09:00, which is richer than five cron fields and reads differently: the time comes after the date pattern.
The practical gain is observability. systemctl list-timers shows the last and next run, and journalctl -u holds the output. Cron leaves that evidence in mail, syslog or nowhere, depending on the host.
Missed runs and load spikes
If the machine is off at the scheduled moment, a cron job is simply missed. A timer with Persistent=true remembers the last trigger and runs once when the machine comes back. That behaviour is often the deciding factor for backups and certificate renewals.
Both schedulers can stampede: many hosts firing at minute 0 overload shared services. Cron has no built-in jitter, so pick an off-peak minute by hand. systemd offers RandomizedDelaySec= to spread timers that share a schedule.
Frequently asked questions
Can systemd timers run catch-up jobs?
Yes. With Persistent=true, a calendar timer that was missed while the machine was off runs once after boot.
Do systemd timers use cron syntax?
No. OnCalendar has its own calendar expression syntax; five-field cron expressions must be translated.
Which shows the next run time?
systemctl list-timers shows last and next trigger times. Cron does not have an equivalent built-in listing.