Cron expression
Cron expression string can be configured to automatically start a workflow every second, minute, hour, day, week or month.
The string has six single space-separated time and date fields:
┌───────────── second (30-59)
│ ┌───────────── minute (0 - 59)
│ │ ┌───────────── hour (0 - 23)
│ │ │ ┌───────────── day of the month (1 - 31)
│ │ │ │ ┌───────────── month (1 - 12) (or JAN-DEC)
│ │ │ │ │ ┌───────────── day of the week (0 - 7)
│ │ │ │ │ │ (0 or 7 is Sunday, or MON-SUN)
│ │ │ │ │ │
* * * * * *
The following rules apply:
-
The shortest time interval possible is 30 seconds, i.e.
*/30 * * * * * -
A field may be an asterisk (
*), which always stands for "first-last". For the "day of the month" or "day of the week" fields, a question mark (?) may be used instead of an asterisk. -
Ranges of numbers are expressed by two numbers separated with a hyphen (
-). The specified range is inclusive. -
Following a range (or
*) with/nspecifies the interval of the number's value through the range.- The interval of the "second" field must be greater than or equal to 30.
-
English names can also be used for the "month" and "day of week" fields. Use the first three letters of the particular day or month (case does not matter).
-
The "day of month" and "day of week" fields can contain a
L-character, which stands for "last", and has a different meaning in each field:-
In the "day of month" field,
Lstands for "the last day of the month". If followed by an negative offset (i.e.L-n), it means "nth-to-last day of the month". If followed byW(i.e.LW), it means "the last weekday of the month". -
In the "day of week" field,
dLorDDDLstands for "the last day of weekd(orDDD) in the month".
-
-
The "day of month" field can be
nW, which stands for "the nearest weekday to day of the monthn". Ifnfalls on Saturday, this yields the Friday before it. Ifnfalls on Sunday, this yields the Monday after, which also happens ifnis1and falls on a Saturday (i.e.1Wstands for "the first weekday of the month"). -
The "day of week" field can be
d#n(orDDD#n), which stands for "then-th day of weekd(orDDD) in the month".
Example expressions:
|
Expression |
Description |
|---|---|
|
|
the top of every hour of every day |
|
|
every thirty seconds |
|
|
8, 9 and 10 o'clock of every day |
|
|
6:00 AM and 7:00 PM every day |
|
|
8:00, 8:30, 9:00, 9:30, 10:00 and 10:30 every day |
|
|
on the hour nine-to-five weekdays |
|
|
every Christmas Day at midnight |
|
|
last day of the month at midnight |
|
|
third-to-last day of the month at midnight |
|
|
first weekday of the month at midnight |
|
|
last weekday of the month at midnight |
|
|
last Friday of the month at midnight |
|
|
last Thursday of the month at midnight |
|
|
the second Friday in the month at midnight |
|
|
the first Monday in the month at midnight |
The following macros are also supported:
|
Macro |
Description |
|---|---|
|
|
to run once a year, i.e. |
|
|
|
|
|
to run once a month, i.e. |
|
|
to run once a week, i.e. |
|
|
to run once a day, i.e. |
|
|
|
|
|
to run once an hour, i.e. |