← All cheat sheets

Tools

Cron Cheat Sheet — Crontab Syntax & Schedule Examples

Cron expressions have five fields. This reference explains each one, the special characters, and gives schedules you can copy directly.

Put it into practice with the matching tool.

Build a cron expression →

Advertisement

Field order

minute0–59
hour0–23
day of month1–31
month1–12
day of week0–6 (0 = Sunday)
* * * * *All five fields in order — runs every minute

Special characters

*Every value for that field
*/5Step — every 5 units
1,15List — at 1 and 15
9-17Range — from 9 through 17
0-30/10Range with a step — 0, 10, 20, 30

Common schedules

*/15 * * * *Every 15 minutes
0 * * * *Every hour, on the hour
0 0 * * *Every day at midnight
0 8 * * 1-5Every weekday at 8:00 am
0 3 * * 0Every Sunday at 3:00 am
0 0 1 * *First day of every month at midnight
30 2 1 1 *Once a year — 1 January at 2:30 am

Shorthand strings

@hourlySame as 0 * * * *
@dailySame as 0 0 * * *
@weeklySame as 0 0 * * 0
@monthlySame as 0 0 1 * *
@yearlySame as 0 0 1 1 *
@rebootRun once at startup

Crontab commands

crontab -eEdit your crontab
crontab -lList your crontab
crontab -rRemove your crontab (careful)

Cron in practice

Reading an expression aloud

Read the fields in order — minute, hour, day of month, month, day of week — and translate each into words. 30 6 * * 1-5 is "at minute 30 of hour 6, any day of the month, any month, Monday to Friday": 06:30 on weekdays. 0 */4 * * * is "at minute 0 of every fourth hour": 00:00, 04:00, 08:00 and so on. 15 2 1 * * is 02:15 on the first of each month. If you cannot read an expression aloud confidently, preview its next run times before deploying.

The day-of-month and day-of-week trap

When both day fields are set to something other than *, standard cron runs the job when either matches. 0 9 1 * 1 runs at 09:00 on the first of every month and also every Monday — not only on Mondays that fall on the first. To run on the first Monday of a month, schedule for Mondays and check the date in the script, for example by exiting unless the day of the month is 7 or less.

Time zones and environment

Cron uses the server's time zone, usually UTC on cloud machines, and GitHub Actions schedules are always UTC. Jobs scheduled between 01:00 and 03:00 local time can be skipped or run twice when daylight saving changes. Cron also runs commands with a minimal environment: a short PATH, no shell profile, and a different working directory. Use absolute paths to scripts and programs, set needed variables at the top of the crontab, and redirect output to a log file — >> /var/log/backup.log 2>&1 — so failures are visible.

Avoiding overlaps and spikes

If a job can run longer than its interval, two copies may run at once and corrupt data. Wrap it with a lock, for example flock -n /tmp/report.lock /usr/local/bin/report.sh, so a second copy exits immediately. Spread jobs across the hour instead of scheduling everything at minute 0, which creates load spikes on your servers and on shared services such as package mirrors and APIs.

Testing a job

Before relying on a schedule, run the exact command manually as the same user cron will use, then schedule it a couple of minutes ahead and check the log. Remember that % has special meaning in crontab lines and must be escaped as \%, a common reason date-stamped file names fail only under cron.

Related guides

More cheat sheets