Cron Expressions Use formatting
Seconds |
Minutes |
Hours |
DayOfMonth |
Month |
DayOfWeek |
[Year] |
Seconds |
Part |
When |
One day of the month |
Month |
One day in the week |
[Year optional] |
The meaning of each symbol is: *: matches any value of the field, such as * used in the domain where the division is located, indicating that events are triggered every minute.?: matches any value of the field. The days of the Tianhe week of the month are conflicting, one of them must be set to? -: Matches a specific range value, such as when the value of the field is 10-12, which indicates that 10, 11, 12 points will trigger the event. : matches multiple specified values, such as the value of the field in which the week is 2,4,6, indicating that events will be triggered in Monday, Wednesday, and Friday (1 for Sunday, 2 for Monday, 3 for Tuesday, and 7 for Saturday). /: On the left is the start trigger time, the right side is every fixed time trigger an event, such as seconds in the field of the value is 5/15, indicating 5 seconds, 20 seconds, 35 seconds, 50 seconds when all triggered an event. L:last, the last meaning, if it is used in the days of this field, represents the last day of the month, if it is used in the domain of the week, such as 6L, indicating the last Friday of a month. (The foreign Sunday is star Yao Day, Monday is the month Yao Day, the beginning of the week is Sunday, so 1l= Sunday, 6l= Friday.) ) W:weekday, the meaning of the workday. The value of the field, such as the day, is 15W, which indicates the most recent weekday of 15th this month, and if 15th is Saturday, the trigger will trigger up to 14th Friday. If 15th is Sunday, the trigger will trigger 16th Monday. If 15th is not Saturday or Sunday, but one from Monday to Friday, then it triggers the event on the 15th day. #: Used to specify the number of weeks ordinal of a month, as 6#3 represents the third Friday of a month. Practical examples of the meaning of an expression
"0 0 12 * *?" |
Triggers events 12:00 every day |
"0 15 10. * *” |
Triggers events 10:15 every day |
"0 15 10 * *?" |
Triggers events 10:15 every day |
"0 15 10 * *? *” |
Triggers events 10:15 every day |
"0 15 10 * *? 2005″ |
2005 Daily 10:15 triggering events |
"0 * 14 * *?" |
Starting 14 o'clock every day, triggering every minute, ending at 14:59. |
"0 0/5 14 * *?" |
Triggers an event every 5 minutes from 14 o'clock every day, starting at the end of 14:59 |
"0 0/5 14,18 * *?" |
Triggers an event every 5 minutes from the start of 14 o'clock to 14:59 and 18 to 18:59 every day |
"0 0-5 14 * *?" |
Triggers an event every 1 minutes from 14 o'clock to 14:05 every day |
"0 10,44 14?" 3 WED " |
Every March of Wednesday, 14:10 and 14:44 trigger an event. |
"0 15 10?" * Mon-fri " |
Monday to Friday 10:15 triggers an event |
"0 15 10 15 *?" |
Every month 15th 10:15 triggers an event |
"0 L *?" |
10:15 of the last day of each month triggers an event |
"0 15 10?" * 6L " |
The last Friday 10:15 of the month triggers an event |
"0 15 10?" * 6L 2002-2005″ |
2002 to 2005 the last of the monthly Friday 10:15 triggers an event |
"0 15 10?" * 6#3″ |
The third Friday 10:15 of the month triggers an event |