Wiki

Clone wiki

scheduler-cron / Cron format

Cron format is a simple, yet powerful and flexible way to define time and frequency of various actions.

CronJob supports enhanced version of Cron format: m h d M w Y:

  • m - the minute value (0-59)

  • h - the hour value (0-59)

  • d - the day value (1-31)

  • M - the month value (1-12)

  • w - the weekday value (1-7)

  • Y - the year value (1900-2100)

This version of format contains of 6 fields. Each field can be a numeric value or asterisk: 5 6 \* 1 10 \*. Numeric value means that function will be executed in the time value. Asterisk means that function will be executed cyclic for this time field.

Some examples:

  • \* \* \* \* \* \* - execute every minute

  • 10 \* \* \* \* \* - execute every hour in 10 minutes

  • 0 12 \* \* \* \* - execute every day in 12:00

  • \* 16 \* \* \* \* - execute every minute in 16th hour of day every day

Since v1.1 the format with second and millisecond fields are supported

This format: ms s m h d M w Y:

  • ms - the millisecond value (0-999)

  • s - the second value (0-59)

Other fields are the same like in v1.0

The extended format is supported: all right side fields will be added as asterisk and all left side ones will be added as 0 values. All the formats supported in v1.0 will be extended with 0 second and 0 millisecond values

Some examples:

  • 5 \* will be converted to 0 0 5 \* \* \* \* \* (every hour in 5 mins, 0 s and 0 ms

  • Empty line will be converted to 0 0 \* \* \* \* \* \*

  • * 13 11 9 4 3 2016 will be converted to 0 * 13 11 9 4 3 2016

Updated