Cron is how computers have run things on a schedule since the 1970s: backups, emails, cleanups, reports. The schedule is one line of five fields. It is compact, it is exact, and it is easy to get subtly wrong.
The five fields
- 1Minute0 to 59
- 2Hour0 to 23, in 24-hour time
- 3Day of month1 to 31
- 4Month1 to 12
- 5Day of week0 to 6, Sunday is 0 (7 also works in many versions)
Five spaces, five fields. Anything left as * means “every possible value”.
Ten lines you will actually use
| Expression | When it runs |
|---|---|
* * * * * | Every minute |
*/15 * * * * | Every 15 minutes |
0 * * * * | At the top of every hour |
30 2 * * * | Every day at 2:30 am |
0 9 * * 1-5 | At 9:00 am, Monday to Friday |
0 0 * * 0 | Midnight every Sunday |
0 0 1 * * | Midnight on the 1st of every month |
0 8,20 * * * | At 8:00 am and 8:00 pm daily |
0 0 1 1 * | Midnight on 1 January |
*/5 9-17 * * 1-5 | Every 5 minutes between 9:00 and 17:55 on weekdays |
Ranges are inclusive: 9-17 includes the 17:xx hour, so the last run is 17:55.
The same job, three ways
- 0 9 * * 1-5Every weekday morningGood for a daily team summary.
- 0 9 * * 1Every Monday at 9Good for a weekly digest.
- 0 9 1 * *The first of each month at 9Good for billing or monthly reports.
Only the last three fields change. Reading cron is mostly noticing where the stars are.
Six gotchas
- Time zone. Cron uses the server's clock. A job “at 9” on a UTC server runs at 2:30 pm in India. Check with the
datecommand. - Day of month plus day of week.
0 0 13 * 5is not “Friday the 13th”. It runs on the 13th and on every Friday. - Every minute by accident. Leaving the minute field as
*while setting an hour, as in* 9 * * *, runs 60 times during the 9 o'clock hour. */nis not “every n from now”.***/45in the minutes field runs at :00 and :45 every hour, then restarts at :00.- Missed runs. If the server was off at the time, standard cron does not catch up.
- Different dialects. Some systems add a seconds field or special names like
@daily. Check yours.
Questions people ask
What do the five fields in a cron expression mean?
In order: minute (0-59), hour (0-23), day of month (1-31), month (1-12) and day of week (0-6, Sunday is 0).
How do I run a cron job every 15 minutes?
Use */15 * * * *. It runs at minute 0, 15, 30 and 45 of every hour.
What does 0 9 * * 1-5 mean?
At 9:00 am, Monday through Friday.
Which time zone does cron use?
The time zone of the machine running it, which is often UTC on servers. Convert your intended time before scheduling.
Why did my cron job run on the wrong days?
If both day-of-month and day-of-week are set, standard cron runs the job when either one matches, not only when both do.

