Cron Expressions

<< Click to Display Table of Contents >>

Navigation:  Content Grabber Editor > Scheduling >

Cron Expressions

The Content Grabber Scheduler uses Cron expressions to define when the scheduler should run an agent. The scheduler supports standard Cron expressions with seconds, but without year, so the expressions consist of 6 parts.

 

Field Name

Mandatory

Allowed Values

Allowed Special Characters

Seconds

Yes

0-59

, - * /

Minutes

Yes

0-59

, - * /

Hours

Yes

0-23

, - * /

Day of Month

Yes

1-31

, - * ? / L W

Month

Yes

1-12 or JAN-DEC

, - * /

Day of Week

Yes

0-7 or SUN-SAT

, - * ? / L #

 

Cron Expression Examples

Cron Expression

Meaning

* * * * * *

Execute a job every second

0 */5 * * * *

Execute a job every 5 minutes

0 0 * * * *

Execute a job every hour.

0 0 12 * * *

Executes a job at 12pm (noon) every day

0 0/5 14,18 * * *

Executes a job every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day

0 0 0 * * 3

Executes a job at midnight every Wednesday.

0 15 10 L * *

Executes a job at 10:15am on the last day of every month

0 15 10 15 * *

Executes a job at 10:15am on the 15th day of every month

0 0 0 1,2 * *

Executes a job at midnight of 1st, 2nd day of each month

0 15 10 * * 5#3

Executes a job at 10:15am on the third Friday of every month

 

Special characters

Asterisk ( * ) - The asterisk indicates that the cron expression matches for all values of the field. E.g., using an asterisk in the 2th field (minute) indicates every minute. * is a non-restricted character.

 

Slash ( / ) - Slashes describe increments of ranges. For example 3-59/15 in the 2st field (minutes) indicate the third minute of the hour and every 15 minutes thereafter. The form "*/..." is equivalent to the form "first-last/...", that is, an increment over the largest possible range of the field.

 

Comma ( , ) - Commas are used to separate items of a list. For example, using "1,2,5" in the 6th field (day of week) means Mondays, Wednesdays and Fridays.

 

Hyphen ( - ) - Hyphens define ranges. For example, using "MON-FRI" in the 6th field (day of week) means all weekdays, but not weekends.

 

L - 'L' stands for "last". When used in the day-of-week field, it allows you to specify constructs such as "the last Friday" ("5L") of a given month. In the day-of-month field, it specifies the last day of the month.

 

W - The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month." So, if the 15th is a Saturday, the job executes on Friday the 14th. If the 15th is a Sunday, the job executes on Monday the 16th. If the 15th is a Tuesday, then it executes on Tuesday the 15th. However if you specify "1W" as the value for day- of-month, and the 1st is a Saturday, the job executes on Monday the 3rd, as it does not 'jump' over the boundary of a month's days. The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.

 

Hash ( # ) - '#' is allowed for the day-of-week field, and must be followed by a number between one and five. For example, 5#2 indicates "the second Friday" of a given month.

 

Question mark ( ? ) - It is used instead of '*' for leaving either day-of-month or day-of-week blank. ? is a restricted character.