- If you open the Application settings tab in Work-IT from Menu > Tools > Application settings, and then click on the sub-tab Job. You will see the following table:
- In the Job time settings column you will see the Cron codes.
For example let's choose the row autoPathPartCorrectionJobDetailTrigger with Cron code ( 0 0 22 * * ? )
Which means : apply this job (function) every day at 22.00 , and the job here is to calculate the sub-paths for the paths where more than one employee carried out one specific start task within a set period (task questions schedule).
The example below divides the path part according to the time, and due to the cron settings it determines with which interval is run this calculation.
Let's change (autoPathPartCorrectionJobDetailTrigger) job setting to ( 0 0 0/1 1/1 * ? * )
Which means: apply this job At second :00, at minute :00, every hour starting at 00am, every day starting on the 1st day of the month, every month.
- See the following explanation :
Star ( * )
Star means every. For example if you fill * in de month field that means apply the job every month.
Comma ( , )
Commas are used to separate items of a list. For example, using "MON,WED,FRI" in the 6th field (day of week) means apply the job only in Mondays, Wednesdays and Fridays.
Hyphen ( - )
Hyphens define ranges. For example, 2000–2010 indicates every year between 2000 and 2010, inclusive.
Slash (/)
Slashes can be combined with ranges to specify step values. For example, */5 in the minutes field indicates every 5 minutes . It is shorthand for the more verbose POSIX form 5,10,15,20,25,30,35,40,45,50,55,00. POSIX does not define a use for slashes
Question mark (?)
In some implementations, used instead of '*' for leaving either day-of-month or day-of-week blank. so that ? ? * * * * would be updated to 25 8 * * * * if job started-up on 8:25am, and would run at this time every day until restarted again.
Hash (#)
'#' is allowed for the day-of-week field, and must be followed by a number between one and five. It allows you to specify constructs such as "the second Friday" of a given month. For example, entering "5#3" in the day-of-week field corresponds to the third Friday of every month.
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 trigger fires on Friday the 14th. If the 15th is a Sunday, the trigger fires on Monday the 16th. If the 15th is a Tuesday, then it fires on Tuesday the 15th. However, if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger fires 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.
- Cron Expression Examples
Let us see some examples of cron expression by using the fields and specials characters combinations:
At 12:00 pm (noon) every day during the year 2017:
0 0 12 * * ? 2017
Every 5 minutes starting at 1 pm and ending on 1:55 pm and then starting at 6 pm and ending at 6:55 pm, every day:
0 0/5 13,18 * * ?
Every minute starting at 1 pm and ending on 1:05 pm, every day:
0 0-5 13 * * ?
At 1:15 pm and 1:45 pm every Tuesday in the month of June:
0 15,45 13 ? 6 Tue
At 9:30 am every Monday, Tuesday, Wednesday, Thursday, and Friday:
0 30 9 ? * MON-FRI
At 9:30 am on 15th day of every month:
0 30 9 15 * ?
At 6 pm on the last day of every month:
0 0 18 L * ?
At 6 pm on the 3rd to last day of every month:
0 0 18 L-3 * ?
At 10:30 am on the last Thursday of every month:
0 30 10 ? * 5L
At 6 pm on the last Friday of every month during the years 2015, 2016 and 2017:
0 0 18 ? * 6L 2015-2017
At 10 am on the third Monday of every month:
0 0 10 ? * 2#3
At 12 am midnight on every day for five days starting on the 10th day of the month:
0 0 0 10/5 * ?
- You can use this tool by clicking here, to convert cron expression to readable text format or generate cron expression.