Cron is wonderful. It's been running jobs since the 1970s, and its five little fields are lodged in every sysadmin's brain. But cron has a habit: it runs your job, throws the output at a mailbox nobody reads, and forgets about it. systemd timers do the same work, remember what happened, and tell you about it.
If your machine runs systemd (most distros do), you already have everything you need.
Two files instead of one line
A cron job is one line. A systemd timer is two small files: a service that says what to run, and a timer that says when.
Say you have a nightly backup script. Create /etc/systemd/system/backup.service:
[Unit]
Description=Nightly backup
[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup.sh
Then create /etc/systemd/system/backup.timer next to it:
[Unit]
Description=Run the nightly backup
[Timer]
OnCalendar=*-*-* 02:30:00
Persistent=true
RandomizedDelaySec=15m
[Install]
WantedBy=timers.target
Matching names matter: backup.timer starts backup.service automatically. Switch it on:
sudo systemctl daemon-reload
sudo systemctl enable --now backup.timer
Yes, it's more typing than cron. Here's what the extra lines buy you.
The three lines cron can't do
Persistent=true remembers the last run. If the laptop was asleep at 2:30, the job runs as soon as it wakes. Cron just skips it and says nothing.
RandomizedDelaySec=15m starts the job at a random moment up to fifteen minutes late. On one machine that doesn't matter. On twenty machines sharing one backup server, it's the difference between a calm night and a stampede at 2:30:00.
Type=oneshot tells systemd the job runs and then exits. systemd tracks it while it runs, so a second copy can't start while the first is still going. In cron, avoiding that overlap is a flock trick you have to remember yourself.
See what's scheduled
systemctl list-timers
You get a neat table: when each timer runs next, how long until then, when it last ran, and which service it triggers. Compare that with crontab -l for every user on the box and trying to work out the next run in your head.
Read what happened
This is the best part. Everything your script prints goes to the journal:
journalctl -u backup.service
journalctl -u backup.service --since today
Did it fail? Check:
systemctl status backup.service
It shows the exit code, the last run and the last few log lines. A failed run marks the unit as failed, and monitoring can watch for that with a single command: systemctl --failed.
Test your schedule before trusting it
Cron syntax is famous for "wait, does that mean every minute?". systemd will check the expression for you:
systemd-analyze calendar "Mon..Fri 09:00"
Original form: Mon..Fri 09:00
Normalized form: Mon..Fri *-*-* 09:00:00
Next elapse: Mon 2026-11-16 09:00:00 PST
A few forms worth knowing:
daily,weeklyandhourlywork as you'd guess.*-*-* 02:30:00means every day at 2:30.Sat *-*-1..7 10:00means the first Saturday of every month at 10:00.*:0/15means every fifteen minutes.
A one-off, no files needed
Want something to run once, in half an hour? Skip the unit files:
systemd-run --on-active=30m /usr/local/bin/backup.sh
It's like at, except it's already installed and it logs to the journal.
Should you migrate everything?
No need. Cron still works, and a one-line job on a personal box is fine where it is. Move the jobs that matter: backups, certificate renewals, anything that would hurt if it quietly stopped. Those are the ones where "it logs every run and says when it failed" is worth a second file.
Your 2:30 a.m. self will appreciate it.
Linux
More like this
Linux
entr and watch: Make Your Terminal Rerun Things So You Don't Have To
Save, switch window, press up, press Enter, squint. Save, switch window, press up... Stop. entr reruns your command whenever a file changes, and watch reruns it on a timer. Two tiny tools, a thousand saved keystrokes.
Linux
ripgrep: grep, But It Drank Three Espressos and Read Your .gitignore
grep is a legend. It's also happy to search all 80,000 files in node_modules while you wait. ripgrep searches only what matters, very quickly, with sensible defaults. The flags worth knowing, and when old grep still wins.
Linux
Linux Terminal Toys (and the Surprisingly Useful Tools Hiding Among Them)
A talking cow, a train that punishes typos, the Matrix in your terminal, and hidden among them, six genuinely useful tools you'll keep long after the novelty wears off. A toy box for Linux nerds.