This topic describes how to configure CRON expressions.
CRON expressions are applicable to one-time tasks that need to be complete at a specific point in time, recurring tasks, and routine maintenance tasks. A CRON expression is a string that represents time. The string consists of five spaces and six fields, which is in the X X X X X X
format. X
is a field placeholder. If a field contains multiple values, the values are separated by commas (,
). Each field can contain a specific value or special characters that have logical representations.
Field values
The following table describes valid values and supported special characters for each field in CRON expressions.
Field | Required | Value range | Supported special character |
Second | Yes | [0, 59] | N/A |
Minute | Yes | [0, 59] | Commas (,) and forward slashes (/) are supported in some scenarios. If you use a comma (,) to separate two values, the interval between the two values must be greater than or equal to 30 minutes. If you use a forward slash (/) to separate two values, the latter value must be greater than or equal to 30 minutes. |
Hour | Yes | [0, 23] | * , - / |
Day-of-month | Yes | [1, 31] | * , - / ? L |
Month | Yes | [1, 12] or [JAN, DEC] | * , - / |
Day-of-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 valid values. | In the Month field, an asterisk ( |
| Lists enumerated values. | In the Minute field, |
| Indicates a range. | In the Day-of-month field, |
| Indicates increments. | In the Day-of-month field, |
| Indicates that the field is not specified. Only the Day-of-month and Day-of-week fields support this character. | If you specify the Day-of-month or Day-of-week field, you must set the other field to a question mark ( |
| Indicates the last day. Only the Day-of-month field supports this character. Do not specify a list or range if you use the | In the Day-of-month field, |
Examples
The following table describes examples of CRON expressions.
Example | Description |
| Runs the task at 10:15 every day. |
| Runs the task at 10:15 every day. |
| Runs the task at 12:00 every day. |
| Runs the task at 10:00, 14:00, and 16:00 every day. |
| Runs the task every 40 minutes from 09:00 to 17:00 every day. |
| Runs the task at 12:00 every Wednesday. |
| Runs the task at 10:15 on the 15th day of every month. |
| Runs the task at 10:15 on the last day of every month. |
| Runs the task at 14:00 and 14:30 every Wednesday in March every year. |
| Runs the task at 01:00 on the first Wednesday of every month. |