Syntax for the schedule expression
The schedule expression is used to define the schedule for the job to be executed. The schedule expression is defined using the CRON syntax.
This table lists the syntax for the job scheduler command:
Field Name | Allowed Values | Allowed Special Characters |
---|---|---|
Minutes | 0-59 | , - * / |
Hours | 0-23 | , - * / |
Day of Month | 1-31 | , - * ? / L W |
Month | 1-12 or JAN-DEC | , - * / |
Day of Week | 1-7 or SUN-SAT | , - * ? L # |
Year (optional) | NULL or 1970 - 2199 | , - * / |
Exception (optional) | 1-31, 1-12 or JAN-DEC | , - * ? / L # W |
This table lists the special characters that can be used in the syntax of the schedule expression:
Special Characters | Usage |
---|---|
Comma (,) | This character is used to specify the additional values. For example, if "MON,WED,FRI" is specified in the Day of Week field, then the days are Monday, Wednesday, and Friday respectively. |
Hyphen (-) | This character is used to specify the range. For example, if "10-12" is specified in the hour field, then the hours are 10, 11, and 12 respectively. |
Asterisk (*) | This character is used to specify all the values. For example, if "*" is specified in the minutes field, then every minute is considered. |
Slash (/) | This character is used to specify increments. For example, if "0/15" is specified in the seconds field, then the seconds are 0, 15, 30, 45, and 60. If "5/15" is specified in the seconds field, then the seconds are 5, 20, 35, and 50 respectively. The form "*/..." is equal to the form "first-last/...", that is, an increment over the largest possible range of the field. |
Question Mark (?) | This character is used in the Day of Month and Day of Week fields. This is used to specify 'No Specific Value' and when one of the two fields must be specified, but not the other. For example, to execute the syntax on a particular day of the month (10th), but not a specific day of the week, the specify "10" in the Day of Month field, and "?" in the Day of Week field. |
L (Last) | This character is used in Day of Month and Day of Week fields. For example, if you specify "L" in the Day of Month field, then the day is the last day of the month. If "L" is specified in the Day of Week field, then the day is "7" or "SAT". But if "L" is specified in the Day of Week field after another value, then the day is "the last xxx day of the month" - for example "6L" means "the last Friday of the month". When using the 'L' option, the lists, or ranges of values must not be specified. |
W | This is used in Day of Month field to specify the weekday nearest to the specified day. For example, if you specify 15W in the Day of Month field, the day is "nearest day to the 15th of the month". If 15th of the month is Saturday, 14th is the Day of Month; if the 15th is Sunday, 16th is Day of Month. |