Cron every 5 minutes, and other common schedules
A cheat sheet of the cron lines people actually need, each one ready to copy and explained in plain words.
Cheat sheet
Five fields, left to right: minute, hour, day of month, month, day of week. Click any line to see it explained with its next run times.
| Schedule | Cron |
|---|---|
| Every minute | * * * * * |
| Every 5 minutes | */5 * * * * |
| Every 15 minutes | */15 * * * * |
| Every 30 minutes | */30 * * * * |
| Every hour, on the hour | 0 * * * * |
| Every 6 hours | 0 */6 * * * |
| Every day at midnight | 0 0 * * * |
| Every day at 2:30 am | 30 2 * * * |
| Weekdays at 9 am | 0 9 * * 1-5 |
| Every 10 minutes during office hours | */10 9-17 * * 1-5 |
| Sundays at midnight | 0 0 * * 0 |
| First day of every month | 0 0 1 * * |
| 1 January each year | 0 0 1 1 * |
Gotchas worth knowing
Steps restart every hour
*/7 means minutes 0, 7, 14 … 56, then 0 again. The gap from :56 to :00 is only 4 minutes. Steps that divide 60 evenly (5, 10, 15, 20, 30) do not have this problem.
Which time zone?
Cron uses the time zone of the machine it runs on, and servers are usually on UTC. "Every day at 9" on a UTC server is 10 am in London for half the year. Some schedulers accept CRON_TZ=Europe/London at the start of the line, and Kubernetes CronJobs have a timeZone field. Around daylight-saving changes, a job set inside the skipped hour may not run that night, and one inside the repeated hour may run twice, depending on the cron implementation.
GitHub Actions schedules
They are always in UTC, the shortest interval is every 5 minutes, and runs can start late when GitHub is busy, especially at the top of the hour. Picking an odd minute such as 17 * * * * often helps.
Day of month and day of week together
When both are set, classic cron runs when either matches. 0 0 13 * 5 runs on every 13th and on every Friday, not only on Friday the 13th.
The last day of the month
Standard cron has no "last day" field. A common trick is to run on days 28 to 31 and let the command check whether tomorrow is the 1st:
0 23 28-31 * * [ "$(date -d tomorrow +\%d)" = "01" ] && /path/to/jobThe % has to be escaped as \% inside a crontab, because cron treats a bare % as a newline. date -d is the GNU version found on Linux.
Job never fires at all? See Cron job not running / crontab not executing. Decode any expression with the cron explainer or Anvil /v1/cron/explain.
Questions
What does */5 mean in cron?
Every value in the field that is a multiple of 5, starting from the lowest. In the minute field that is 0, 5, 10 … 55, so the job runs 12 times an hour.
Can cron run every 30 seconds?
Not directly; the smallest unit is a minute. A common workaround is two lines, one running the job and one running sleep 30 followed by the job.
How do I run a cron job every 5 minutes only on weekdays?
Use */5 * * * 1-5. The last field limits it to Monday (1) to Friday (5).
Published .