PatternCron

Every 10 minutes, overnight only

A batch-processing window that only runs while traffic is quiet: every 10 minutes, but strictly between midnight and 6 AM.

Last updated

Pattern
*/10 0-5 * * *
Open in Crontab Schedule Creator

In plain English

  • Fires every 10 minutes between 00:00 and 05:59
  • 36 runs per night

Why it’s written this way

*/10 in the minute field gives six firings an hour; 0-5 in the hour field restricts those hours to midnight through 05:59. Combined, the job runs every 10 minutes for a fixed six-hour overnight window and stays silent the rest of the day.

Restricting both minute and hour like this is how a 'window' schedule gets built out of fields that only know how to say 'at this time' or 'every N units' — the window itself is just the hour range doing the work.

Edge cases to know

  • →Cron hour ranges don't wrap: 0-5 means midnight through 5am, but there's no way to write '22 through 5' as a single range. An overnight window crossing midnight the other direction needs a comma list instead, like 22,23,0,1,2,3,4,5.
  • →Six hours at a 10-minute cadence is 36 runs a night; if the batch job occasionally runs long, the window can end with a run still in flight when 06:00 arrives — decide up front whether it should be killed or allowed to finish past the boundary.
  • →The window is defined in the server's local clock; a host set to UTC has a very different 'overnight' than one set to local time — confirm which one before assuming this actually covers the low-traffic hours.

Part by part

*/10
Every tenth minute — six runs an hour at 0, 10, 20, 30, 40 and 50 past.
0-5
The hour range, midnight through 05:59 inclusive. Ranges in cron include both endpoints, so this is six hours rather than five.

Common mistakes

  • */10 0-5 * * * expecting it to stop at 05:00

    The range includes hour 5, so runs continue through 05:50. Cron ranges are inclusive at both ends, which is a consistent rule and a frequent off-by-one.

    */10 0-4 * * *
  • */10 22-6 * * *

    A range that wraps past midnight is invalid — cron ranges do not wrap. A window from 22:00 to 06:00 has to be written as two entries, or as the list 22,23,0-6.

  • */10 0-5 * * * for a job that must finish before the working day

    The last run starts at 05:50 and may still be going at 09:00. A window bounds when work starts, never when it ends, so a long job needs its own timeout.

Questions

How do I schedule a window that crosses midnight?

Two lines, or a list of hours. 22,23,0-6 covers 22:00 to 06:59 in one field, since a list may contain ranges — which is the tidier of the two options.

How many runs is this?

Thirty-six a night: six per hour across six hours, midnight through 05:59. Counting it out is worth doing whenever a step and a range are combined, because the inclusive endpoint is easy to lose.

Does an overnight window survive a clock change?

Badly, in zones that shift within it. The spring change can skip an hour of runs entirely and the autumn one can repeat them, so a job that must run a fixed number of times should not span the transition.

Why restrict to overnight at all?

Usually to keep expensive work away from peak traffic — a backup, a rebuild, a bulk export. If the reason is load rather than data freshness, a low-priority queue is often a better answer than a time window.

Related in Patterns