Skip to content

Automation & Operations3 min read

How to Create a Cron Schedule

Cron runs a job on a schedule, and its five fields put people off for no good reason. Here is what each one means and how to build or read an expression.

KLYRO TeamPublished

klyro / tools / cron-builderIn your browser0MINUTE9HOUR*DAY*MONTH1-5WEEKDAYWHAT IT MEANSAt 09:00, Monday to Friday.NEXT RUNSMon 09:00Tue 09:00Wed 09:00Read from the parsed expression

Cron is the scheduler almost everything uses: servers, hosting panels, backup tools, deployment pipelines and most automation platforms. A cron expression is five values separated by spaces, and it says when a job should run.

It looks cryptic and it is not. Once you know which field is which, you can read almost any schedule at a glance.

The five fields

Always in this order, always separated by a single space.

┌───────────── minute        (0 - 59)
│ ┌─────────── hour          (0 - 23)
│ │ ┌───────── day of month  (1 - 31)
│ │ │ ┌─────── month         (1 - 12)
│ │ │ │ ┌───── day of week   (0 - 6, Sunday is 0)
│ │ │ │ │
0 9 * * 1-5
0 9 * * 1-5 means: at 09:00, Monday to Friday.
MINUTE00–59HOUR90–23DAY OF MONTH*1–31MONTH*1–12DAY OF WEEK1-50–60 9 * * 1-5CopyFive fields, always in this order. An asterisk means “every”.
Each field shows its valid range, so an out-of-range value is obvious before you save it.

The four symbols

SymbolMeansExample
*Every value in this field* * * * * runs every minute
,A list of specific values0 9,17 * * * runs at 09:00 and 17:00
-A range0 9 * * 1-5 runs weekdays only
/A step within a range*/15 * * * * runs every 15 minutes
Everything else is a combination of these four.

Schedules you will actually use

ExpressionWhen it runs
0 * * * *Every hour, on the hour
*/15 * * * *Every 15 minutes
0 2 * * *Every day at 02:00
0 9 * * 1-5Weekdays at 09:00
30 3 * * 0Sundays at 03:30
0 0 1 * *Midnight on the first of every month

How to read an expression you were given

  1. Paste it in

    Any standard five-field expression. If it cannot be parsed, the tool says so rather than guessing at what you might have meant.

  2. Read the plain-English line

    The explanation is derived from the parsed expression itself, so a schedule you pasted and one you built are read by exactly the same code.

  3. Check the next few runs

    This is the part that catches mistakes. An expression that looks right and whose next run is three weeks away is telling you something.

PASTE AN EXPRESSION*/15 8-18 * * 1-5WHAT IT MEANSEvery 15 minutes, between 08:00 and 18:00, Monday to Friday.The explanation is read from the parsed expression. If it cannot be parsed, the tool says so.
The explanation comes from the parsed expression, never from pattern matching on the text.

Common mistakes

  • Setting the day of month and the day of week together. On most cron implementations 0 0 1 * 1 runs on the 1st *or* on Mondays, not on Mondays that fall on the 1st. Leave one of them as *.
  • Forgetting the server's timezone. Cron uses the machine's clock. A job set for 09:00 on a UTC server runs at 10:00 British Summer Time.
  • Running everything on the hour. If a dozen jobs all fire at 0 * * * *, they compete. Spread them across the hour.
  • Scheduling something for 31 February. 0 0 31 2 * is valid and will never run.
  • Assuming the previous run finished. Cron starts a job on schedule whether or not the last one is still going.

Questions

What is the shortest interval cron supports?
One minute. Standard cron has no seconds field. If you need something more frequent than that, cron is the wrong tool.
Do the six-field expressions I have seen work here?
This builder handles the standard five-field format. Some schedulers add a seconds field at the front or a year at the end; those are extensions, not standard cron.
Is 0 the same as Sunday or Monday?
Sunday. Both 0 and 7 mean Sunday in most implementations, which is a common source of off-by-one schedules.