Working with Cron Expressions in CFTR
A cron expression is a string consisting of five sub-expressions (fields) that describe the individual details of the cron schedule. The fields in the cron expression are separated by a space and can contain any of the allowed values or special characters. In CFTR, you can schedule reports and incident exports using cron expressions.
Syntax
A valid cron expression must be in the following format:
<minute> <hour> <day (month)> <month> <day (week)>
Allowed Fields and Values
The following table describes the allowed fields and the respective values in a cron expression:
Field Name | Allowed Values | Allowed Special Characters |
---|---|---|
Minute | 0-59 | , - * / |
Hour | 0-23 | , - * / |
Day of Month | 1-31 | , - * / |
Month | 1-12 or JAN-DEC | , - * / |
Day of Week | 0-6 or SUN-SAT | , - * / |
Special Characters
The following table describes the special characters that you can use to define the value of a field in a cron expression.
Special Character | Description |
---|---|
* (Asterisk) | An asterisk indicates that the field accepts all the allowed values in a cron expression. For example, * in the minute field means every minute. |
- (Dash) | A dash indicates a range including the from and to values. For example, 10-12 in the hour field means the hours 10, 11, and 12. |
, (Comma) | A comma indicates specific values. For example, MON,WED,FRI in the day-of-week field means the days Monday, Wednesday, and Friday. |
/ (Forward Slash) | A forward slash indicates specific increments. For example, */15 in the minute field means minutes 0, 15, 30, and 45. In CFTR, the first part before the forward slash must be an asterisk (*) in a cron expression. For example, 0/15 or 5/15 is an invalid value. |
Examples
Following are some examples of cron expressions:
Cron Expression | Definition |
0 0 * * 0 | Runs at 00:00 hrs every Sunday |
10,44 14 * 3 * | Runs at 14:10 hrs and 14:44 hrs every day in the month of March |
* 13,14 * 3 WED | Runs at every minute of the 13th and 14th hours every Wednesday in the month of March |
0 0 * * FRI | Runs at 00:00 hrs every Friday |
0 9 * * * | Runs at 09:00 hrs every day |
*/5 * * * * | Runs every 5 minutes every day |