Introduction to Cronexpression:
Each field has a set of valid values that can be specified, such as
Seconds (seconds): can be represented by the number 0-59,
Minutes ( min): can be represented by the number 0-59,
Hours ( time): can be represented by the number 0-23,
day-of-month ( days): You can use any of the one by one values in the number 1-31, but be aware of some special months
Month: can be used with 0-11 or string "JAN, FEB, MAR, APR, May, June, JUL, April, SEP, OCT, NOV and DEC" indicated
Day-of-week ( weekly ) : can be represented by the number 1-7 (1 = Sunday) or by the word Fukou string "SUN, MON, TUE, WED, THU, FRI and SAT"
"/": For a special unit, expressed as "each", such as "0/15" means to execute every 15 minutes, "0" is expressed as starting from "0", "3/20" means to execute every 20 minutes, "3" for the 3rd minute start of execution
“?” : Indicates a day of the month, or a day of the week
"L": For each month, or weekly, expressed as the last day of the month, or the last week of each month as "6L" means "last Friday of the month"
"W": indicated as the most recent weekday, as "15W" is placed on the monthly (day-of-month) field as "the most recent working day of 15th this month"
"#": Is used to specify "the nth working day of the month, the example in the weekly (Day-of-week) This field is" 6#3 "or" fri#3 "means" the third Friday per month "
1) Cron expression format: Second-time time-of-year (optional).
Allowed special characters for field name allowed values
Seconds 0-59,-*/
Sub 0-59,-*/
Hours 0-23,-*/
Day 1-31,-*? /L W C
Month 1-12 or JAN-DEC,-*/
How many weeks 1-7 or SUN-SAT,-*? /L C #
Year (optional field) empty, 1970-2099,-*/
“?” Character: Represents an indeterminate value
"," character: Specify a number of values
"-" character: Specifies the range of a value
"/" character: Specifies the increment of a value. N/m means starting with N, increasing m each time
"L" character: Used on the last day of the one month, used in the week to represent the last one weeks of the month X
"W" character: Specifies the most recent weekday from the given date (Monday to Friday)
The "#" character: The number of weeks that the month is X. 6#3 said the 3rd Friday of the Month
2) Cron Expression Example:
Execute once every 5 seconds: */5 * * * *?
Executes every 1 minutes: 0 */1 * * *?
Executed at 23 o ' Day: 0 0 23 * *?
Once daily 1 o'clock in the morning: 0 0 1 * *?
Every month, 1th, 1 o'clock in the morning, once: 0 0 1 1 *?
The last day of the month is executed at 23 points: 0 0 L *?
Once a week, Sunday 1 o'clock in the morning: 0 0 1? * L
At 26, 29, 33, execute once: 0 26,29,33 * * *?
Every day 0, 13, 18, 21 points are executed once: 0 0 0,13,18,21 * *?
160401, about the introduction of Cronexpression