The cron minute field: position, range and behaviour
The minute field accepts values from 0 to 59. It is the first field in a five field expression and the second in a six field one.
At a glance
- Range
- 0 to 59.
- Position
- First of five fields, or second of six when a seconds field is present.
- Names
- None. Only numbers, ranges, lists and steps.
- Step behaviour
- Walks from 0, so */2 gives even minutes.
- Divisors of 60
- 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30 all step evenly across the hour boundary.
- Seconds
- A job always starts at second 0 of the matched minute in a five field expression.
In detail
The minute field carries most of the frequency information in a typical cron expression. Every schedule that runs more than once an hour does so because this field matches more than one value, and every schedule that runs once an hour or less does so because it matches exactly one.
It has no names and no aliases, only integers from 0 to 59, and there is no value that means the end of the hour. That is worth stating because the day of week and month fields do accept names, so people reasonably expect some form of shorthand here and there is none.
The set of steps that divide the hour cleanly is small: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30. Any other step leaves a short gap when the hour rolls over, which is why */7 and */45 behave the way they do. If even spacing matters, choose from the divisors.
One thing the field does not control is the second within the minute. A five field expression always fires at second 0, so ten jobs scheduled for the same minute all start together. If you need to stagger jobs within a minute, either use a seconds field where the scheduler supports one, or add a short sleep to the command.
Examples
30 * * * *Once an hour at half past.
*/10 * * * *Six runs an hour.
0,7,14,21,28,35,42,49,56 * * * *The same nine minutes */7 produces, written out.
Things that catch people out
- 60 is out of range. The last minute of an hour is 59.
- A five field job always starts at second 0, so jobs sharing a minute start simultaneously.
- Putting a minute value in the hour position is one of the easiest mistakes to make and produces a valid expression, so nothing warns you.
Try it: Cron Expression Parser
Paste any five or six field expression to get a plain English description, a per field breakdown and the next run times in your local time.
Cron Expression Parser
LOCAL · Browser-OnlyParse cron expressions and see the next scheduled run times
Supports 5-field (minute hour day month weekday), 6-field (with seconds), named values (JAN, MON), and @macros (@daily, @hourly, ...)
Use the dropdowns below to build your cron expression visually, or type a custom value in each field.
Human-Readable Description
Every 5 minutes
Field Breakdown
| Field | Allowed | Value | Meaning |
|---|---|---|---|
| Minute | 0-59 | */5 | every 5 minute(s) |
| Hour | 0-23 | * | every hour |
| Day of Month | 1-31 | * | every day of month |
| Month | 1-12 | * | every month |
| Day of Week | 0-7 | * | every day of week |
Related cron expressions
All cron expressions →The cron hour field: 0 to 23 on a 24 hour clock
The hour field runs 0 to 23 on a 24 hour clock. Midnight is 0, noon is 12, and 24 is out of range. There is no AM or PM notation.
Cron step values: what */n really does
*/n walks a field from its minimum in increments of n. Because it starts at the field minimum, */2 gives even minutes and odd days of the month.
The cron seconds field: the optional sixth position
A six field expression puts seconds first and shifts everything right. The system crontab has no seconds field, so six fields there means a broken job.
Cron every 5 minutes: */5 * * * *
*/5 * * * * fires 288 times a day at minutes 0, 5, 10 and so on. Why every job on the box lands on the same minute and how 2-59/5 fixes it.
The cron day of month field: 1 to 31 and missing dates
The day of month field runs 1 to 31, and a date that does not exist in a given month simply never matches. Steps start at 1, giving odd days.
The cron month field: 1 to 12 with JAN to DEC aliases
The month field runs 1 to 12 and also accepts the three letter names JAN through DEC, case insensitively, including inside ranges and steps.
Tools for this
- Cron Expression Parser Free online cron expression parser - parse cron expressions and see the next scheduled run times
- Crontab Generator Free online crontab generator - build cron expressions visually with an intuitive interface