SafeQ configuration files - CRONTRIGGER Settings

About Crontriggers

images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/information.svg There is a standard CRONTAB convention to set the times for CML/ORS synchronization. CRON is a UNIX tool that has been around for a long time, so its scheduling capabilities are powerful and proven. The CronTrigger class is based on the scheduling capabilities of Cron.

CronTrigger uses "Cron expressions", which are able to create triggering schedules such as: "At 8:00am every Monday through Friday" or "At 1:30am every last Friday of the month".

Cron expressions are powerful, but can be confusing. The information in this section aims to help solve some of the mysteries of creating a cron expression.

Format

A cron expression is a string comprising 6 or 7 fields separated by white space. Fields can contain any of the allowed values, along with various combinations of the allowed special characters for that field. The fields are as follows:

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

1-7 or SUN-SAT

, - * ? / L #

Year

NO

Empty or 1970-2099

, - * /

So, cron expressions can be as simple as this: * * * * ? *
or more complex, like this: 0/5 14,18,3-39,52 * ? JAN,MAR,SEP MON-FRI 2002-2010

Special Characters

*

("ALL VALUES") used to select all values within a field. For example, "*" in the minute field means "EVERY MINUTE".

?

("NO SPECIFIC VALUE")used if you need to specify something in one of the two fields in which the character is allowed, but not the other. For example, if you want your trigger to fire on a particular day of the month (say, the 10th), but you do not care what day of the week that happens to be, you would put "10" in the day-of-month field, and "?" in the day-of-week field. See the examples below for clarification.

-

used to specify ranges. For example, "10-12" in the hour field means "THE HOURS 10, 11 AND 12".

,

used to specify additional values. For example, "MON,WED,FRI" in the day-of-week field means "THE DAYS MONDAY, WEDNESDAY, AND FRIDAY".

/

used to specify increments. For example, "0/15" in the seconds field means "THE SECONDS 0, 15, 30, AND 45". And "5/15" in the seconds field means "THE SECONDS 5, 20, 35, AND 50". "1/3" in the day-of-month field means "FIRE EVERY 3 DAYS STARTING ON THE FIRST DAY OF THE MONTH".

L

("LAST") has a different meaning in each of the two fields in which it is allowed. For example, the value "L" in the day-of-month field means "THE LAST DAY OF THE MONTH" – day 31 for January, day 28 for February on non-leap years. If it is used in the day-of-week field by itself, it simply means "7" or "SAT". But if used in the day-of-week field after another value, it means "THE LAST PARTICULAR DAY OF THE MONTH" – for example "6L" means "THE LAST FRIDAY OF THE MONTH". When using the "L" option, it is important not to specify lists, or ranges of values, because you will get confusing results.

W

("WEEKDAY") used to specify the weekday (Monday-Friday) nearest the given day. For example, if you 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 trigger will fire on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However, if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not "jump over" the boundary of a month's days. The "W" character can only be specified when the day-of-month is a single day, not a range or list of days.
images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/information.svg NOTE: The "L" and "W" characters can also be combined in the day-of-month field to yield "LW", which translates to "LAST WEEKDAY OF THE MONTH".

#

used to specify "the n-th" XXX day of the month. For example, the value "6#3" in the day-of-week field means "THE THIRD FRIDAY OF THE MONTH" (day 6 = Friday and "#3" = the 3rd one in the month). Other examples: "2#1" = the first Monday of the month and "4#5" = the fifth Wednesday of the month. Note that if you specify "#5" and there is not 5 of the given day-of-week in the month, then no firing will occur that month.
images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/information.svg NOTE: The "L" and "W" characters can also be combined in the day-of-month field to yield "LW", which translates to "LAST WEEKDAY OF THE MONTH"

images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/lightbulb_on.svg NOTE: Cron triggers examples can be found: CRONTRIGGER Examples