In plain words
cron is the alarm clock of Linux servers: a line of five fields says when to run a command. The syntax is compact, so easy to misread: 0 0 1 * 1 does not mean "the first Monday of the month". The tool translates the expression into plain English, shows the next actual dates and offers the modern equivalent with systemd.
The five fields
┌───────────── minute (0 to 59)
│ ┌─────────── hour (0 to 23)
│ │ ┌───────── day of month (1 to 31)
│ │ │ ┌─────── month (1 to 12, or jan to dec)
│ │ │ │ ┌───── day of week (0 to 7, 0 and 7 = Sunday, or sun to sat)
│ │ │ │ │
30 3 * * 1-5 command
| Syntax | Meaning | Example |
|---|---|---|
* |
every value | * as hour: every hour |
a,b |
list | 1,15: the 1st and the 15th |
a-b |
range | 1-5: Monday to Friday |
*/n |
every n units | */10 as minute: every 10 minutes |
a-b/n |
every n units within the range | 8-18/2: 08:00, 10:00… 18:00 |
The day-of-month and day-of-week trap
If both fields are restricted, cron runs the task when either one matches. So 0 0 1 * 1 runs on the 1st of every month and every Monday. The tool flags it and adapts the systemd equivalent accordingly.
cron or systemd timer?
| Criterion | cron | systemd timer |
|---|---|---|
| Simplicity | One line | Two files (.timer and .service) |
| Missed runs (machine off) | Lost | Caught up with Persistent=true |
| Logs | Redirect them yourself | In journalctl -u name.service |
| Dependencies (network, mounts) | None | Handled by systemd |
| Random delay, so that all machines do not fire at once | No | RandomizedDelaySec= |
For an occasional task on a workstation, cron is enough. For a backup or a server task, the systemd timer is more robust. Check a systemd expression with systemd-analyze calendar.
To automate a backup, see Backing up a Linux server with restic.