Quiz Entry - updated: 2026.07.14
What are systemd timers and how do they compare to cron?
systemd timers are the modern cron alternative: a .timer unit defines when, a paired .service unit defines what — with proper logging and catch-up for missed runs.
The big conceptual difference from cron is the two-unit split: scheduling (.timer) is separated from the work (.service). That buys you integration with the rest of systemd — output goes to the journal (journalctl -u name), jobs can declare dependencies on other services, and Persistent=true reruns a job that was missed while the machine was off (cron just skips it). The cost is more boilerplate than a one-line crontab entry.
Advantages over cron:
- Better logging (journalctl)
- Can depend on other services
- More flexible time expressions
- Runs missed jobs after system boot
Components:
.timerunit - defines schedule.serviceunit - defines what to run
Example timer unit:
# /etc/systemd/system/backup.timer
[Unit]
Description=Daily backup timer
[Timer]
OnCalendar=*-*-* 02:00:00 # Every day at 2 AM
Persistent=true # Run if missed
[Install]
WantedBy=timers.target
OnCalendar examples:
| Expression | Meaning |
|---|---|
*:00/10 |
Every 10 minutes |
daily |
Every day at midnight |
weekly |
Every Monday 00:00 |
*-*-* 02:00:00 |
Every day at 2 AM |
Manage timers:
systemctl daemon-reload
systemctl enable --now backup.timer
systemctl list-timers