About the Cron Expression

About the Cron Expression

Cron is use in Linux for the time schedule

Format

Seconds Minutes Hours DayofMonth DayofWeek [Year]
The value of each row

SecondMinuteHoursDayofMonthDayofWeekYear
, - * / 0-59 , - * / 0-59 , - * / 0-23 , - * / 1-12 JAN-DEc , - * / ? L C # 1-7 SUN-SAT , - * / 1970-2099

 

Special character:

1. * every
2. ? If the DayofMonth use *, the DayofWeek must use ? to match any
3. - Rang 5-7 means5, 6, 7 match
4. / interval for each, 0/30 means start when 0 and each 30 will match.
5. , It use for list
6. L Means Last
7. W Work day

Sample

0 5,15, * * * ? every week every month each hours 5 and 15 minute match.
0 0 10,14,16 * * ? Every day 10am, 2pm, 4 pm match.
0 15 10 L * ? The last day of each month at 10:15 am

原文地址:https://www.cnblogs.com/mouseleo/p/10238529.html