This topic describes how to configure cron expressions.
Cron expressions are applicable to one-time tasks that need to be completed at a certain time point, recurring tasks, and routine maintenance tasks. A cron expression is a string that represents a set of times. The string is separated by five space characters into six fields, in the format of X X X X X X
, of which X
is a placeholder of a field. If a field contains multiple values, the values are separated with commas (,
). Each field can be a specific value or special characters with logical representations.
Values for fields
The following table lists valid values and supported special characters for each field in cron expressions.
Field | Required | Value range | Allowed special character |
Second | Yes | [0, 59] | * , - / |
Minute | Yes | [0, 59] | * , - / |
Hour | Yes | [0, 23] | * , - / |
Day | Yes | [1, 31] | * , - / ? L |
Month | Yes | [1, 12] or [JAN, DEC] | * , - / |
Week | Yes | [1, 7] or [SUN, SAT]. If you use [1, 7], | * , - / ? |
Special characters
Each field in a cron expression can contain a specific number of special characters. Each special character represents a logical argument.
Special character | Description | Example |
| Indicates all possible values. | In the Month field, an asterisk ( |
| Lists enumerated values. | In the Minute field, |
| Indicates a range. | In the Minute field, |
| Indicates increments. | In the Minute field, |
| Indicates an unspecified value. Only the Day and Week fields support this character. | If either one of the Day and Week fields is specified, the other field must be set to a question mark ( |
| Indicates the last day. Only the Day field supports this character. Do not specify a list or range when using the | In the Day field, |
Value examples
The following table lists some sample values of cron expressions.
Example | Description |
| Performs the task at 10:15 every day. |
| Performs the task at 10:15 every day. |
| Performs the task at 12:00 every day. |
| Performs the task at 10:00, 14:00, and 16:00 every day. |
| Performs the task once every half an hour between 09:00 and 17:00 every day. |
| Performs the task once every minute between 14:00 and 14:59 every day. |
| Performs the task once every minute between 14:00 and 14:05 every day. |
| Performs the task once every five minutes between 14:00 and 14:55 every day. |
| Performs the task once every five minutes between 14:00 and 14:55 and between 18:00 and 18:55 every day. |
| Performs the task at 12:00 every Wednesday. |
| Performs the task at 10:15 on the 15th day of every month. |
| Performs the task at 10:15 on the last day of every month. |
| Performs the task at 14:10 and 14:44 every Wednesday in March every year. |