2026-03-05 · 4 min read
Crontab Syntax Cheat Sheet
A quick reference for crontab scheduling expressions. Bookmark this page for the next time you need to set up a cron job.
The five fields
# ┌───────── minute (0-59)
# │ ┌─────── hour (0-23)
# │ │ ┌───── day of month (1-31)
# │ │ │ ┌─── month (1-12)
# │ │ │ │ ┌─ day of week (0-6, Sunday=0)
* * * * * command-to-run
Special characters
| Char | Meaning | Example |
|---|---|---|
| * | Every value | * (every minute) |
| , | List of values | 1,15 (1st and 15th) |
| - | Range | 1-5 (Mon–Fri) |
| / | Step | */15 (every 15) |
Common patterns
| Expression | Meaning |
|---|---|
| * * * * * | Every minute |
| */5 * * * * | Every 5 minutes |
| 0 * * * * | Every hour (at minute 0) |
| 0 2 * * * | Daily at 2:00 AM |
| 0 0 * * 0 | Weekly on Sunday at midnight |
| 0 0 1 * * | Monthly on the 1st at midnight |
| 0 6 * * 1-5 | Weekdays at 6:00 AM |
| 0 */4 * * * | Every 4 hours |
| 30 3 * * 1 | Mondays at 3:30 AM |
| 0 0 1 1 * | Yearly on January 1st at midnight |
Common gotchas
- Environment variables — Cron runs with a minimal environment. Use full paths (
/usr/bin/python3) instead of relying on$PATH. - Output — By default cron emails output to the user. Redirect to a file or
/dev/nullto avoid filling up the mail spool. - Day of week — Sunday is 0 (or 7 on some systems). Monday is 1.
- Timezone — Cron uses the system timezone by default. Set
CRON_TZ=UTCfor consistency across servers. - Silent failures — If a cron job fails, nothing happens by default. Use a monitoring tool like crond.io to catch failures.
Monitor your cron jobs
Once you've set up your schedule, make sure you know when it breaks. Wrap any cron command with crond-agent to get instant alerts on failures:
*/5 * * * * crond-agent wrap --name "backup" -- /usr/bin/backup.sh