7 min read
2026-03-09
Cron is a task scheduler daemon on Unix systems. Allows you to automatically run commands on a schedule.
* * * * * team │ │ │ │ │ │ │ │ │ └─── Day of the week (0-7, where 0 and 7 = Sunday) │ │ │ └───── Month (1-12) │ │ └─────── Day of the month (1-31) │ └───────── Hour (0-23) └─────────── Minute (0-59)
| Symbol | Meaning | Example |
|---|---|---|
| `*` | Any value | `* * * * *` - every minute |
| `,` | List of values | `1.15 * * * *` - in the 1st and 15th minutes |
| `-` | Range | `1-5 * * * *` - every minute from 1 to 5 |
| `/` | Step | `*/15 * * * *` - every 15 minutes |
| Expression | Schedule |
|---|---|
| `0 * * * *` | Every hour |
| `0 0 * * *` | Every day at midnight |
| `0 9 * * 1-5` | Weekdays at 9:00 |
| `0 9 1 * *` | 1st of every month at 9:00 |
| `*/5 * * * *` | Every 5 minutes |
| `0 0 * * 0` | Every Sunday at midnight |
| `0 8-18 * * 1-5` | Working hours every hour |
@reboot - when the system starts @yearly — once a year (0 0 1 1 *) @monthly — once a month (0 0 1 * *) @weekly - once a week (0 0 * * 0) @daily — every day (0 0 * * *) @hourly - every hour (0 * * * *)
crontab -e # edit crontab crontab -l # show current crontab crontab -r # remove crontab
# Save stdout and stderr to file 0 * * * * /path/to/script.sh >> /var/log/myjob.log 2>&1 # Suppress all output 0 * * * * /path/to/script.sh > /dev/null 2>&1
systemd timers — more flexible control in Linux
GitHub Actions — schedule for CI/CD (schedule: cron)
Celery Beat — periodic tasks in Python
node-cron — scheduler for Node.js
Generate cron expressions visually in Cron Generator.
See also: Unix timestamp, Time zone converter