UNIX cron format
The UNIX cron format is used to specify time in the schedule parameter of the ADMIN_TASK_ADD and ADMIN_TASK_UPDATE procedures.
The cron format has five time and date fields separated by at least one blank. There can be no blank within a field value. Scheduled tasks are executed when the minute, hour, and month of year fields match the current time and date, and at least one of the two day fields (day of month, or day of week) match the current date.
Field name | Allowed values |
---|---|
minute | 0-59 |
hour | 0-23 |
day of month | 1-31 |
month |
|
day of week |
|
Ranges and lists
Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen. The specified range is inclusive. For example, the range 8-11 for an hour entry specifies execution at hours 8, 9, 10 and 11.
1,2,5,9
0-4,8-12
Unrestricted range
A field can contain an asterisk (*), which represents all possible values in the field.
The day of a command's execution can be specified by two fields: day of month and day of week. If both fields are restricted by the use of a value other than the asterisk, the command will run when either field matches the current time. For example, the value 30 4 1,15 * 5 causes a command to run at 4:30 AM on the 1st and 15th of each month, plus every Friday.
Step values
Step values can be used in conjunction
with ranges. The syntax range/step
defines the range and an execution interval.
If you specify first-last/step
, execution takes place at first, then at all successive values that are distant from first by step, until last.
For example, to specify command execution every other hour,
use 0-23/2
. This expression is equivalent to the
value 0,2,4,6,8,10,12,14,16,18,20,22
.
If you
specify */step
, execution takes
place at every interval of step through the unrestricted
range. For example, as an alternative to 0-23/2
for
execution every other hour, use */2
.
Example
Desired task schedule | schedule value |
---|---|
2:10 PM every Monday | 10 14 * * 1 |
Every day at midnight | 0 0 * * * |
Every weekday at midnight | 0 0 * * 1-5 |
Midnight on 1st and 15th day of the month | 0 0 1,15 * * |
6.32 PM on the 17th, 21st and 29th of November plus each Monday and Wednesday in November each year | 32 18 17,21,29 11 mon,wed |