systemd Timers vs Cron: Which Scheduler Should You Use?

Compare systemd timers with cron: reliability, logging, dependencies, calendar syntax, and migration tips.

9 min read
systemd Timers vs Cron: Which Scheduler Should You Use?

Both cron and systemd timers can schedule recurring tasks on Linux. Cron is ubiquitous and simple; systemd timers offer richer reliability, dependencies, and logging. Here's how to choose.

Overview

Cron executes commands based on a 5-field time expression in a minimal environment. systemd timers use unit files, enabling dependency management, standardized logging via journalctl, and calendar-based scheduling.

Quick Examples

Cron (daily at 2:00)
0 2 * * * /usr/local/bin/backup.sh
systemd (timer + service)
[Unit] Description=Nightly backup [Service] Type=oneshot ExecStart=/usr/local/bin/backup.sh # backup.timer [Unit] Description=Run backup daily [Timer] OnCalendar=daily Persistent=true [Install] WantedBy=timers.target

Key Differences

Cron

  • Simple 5-field expression
  • Minimal environment (PATH, SHELL)
  • Logging via syslog (distribution-specific)
  • No native dependency management

systemd Timers

  • Calendar syntax (e.g., OnCalendar=Mon..Fri 09:00)
  • Dependencies and ordering (After=, Requires=)
  • Centralized logs (journalctl -u)
  • Persistence across downtime (Persistent=true)

When to Choose Cron

  • Portable scripts across many Unix-like systems
  • Ultra-lightweight scheduling with no service dependencies
  • Human-friendly, copy/paste cron expressions

When to Choose systemd Timers

  • Need structured logs and journalctl visibility
  • Require dependency ordering or network availability
  • Want missed runs to execute on boot (Persistent=true)

Migration Tips

  1. Start with mission-critical jobs to benefit from logging and persistence.
  2. Mirror your cron schedule using OnCalendar (e.g., daily, weekly, or explicit weekdays).
  3. Create a oneshot .service file for the job and a matching .timer.
  4. Enable and start the timer: systemctl enable --now backup.timer

Helpful Tools

Use the Visual Builder to design a schedule, the Validator to check syntax, and the Timezone Converter to preview runs across time zones.

Ready to Create Your Cron Job?

Now that you understand the concepts, try our cron expression generator to create your own cron jobs!

Try Cron Generator