241 字
1 分钟
cron Expression Structure

cron is a time-based task management system for Unix-like operating systems. Users can use cron to run periodic tasks (which can be commands and scripts) at fixed times, dates, and intervals. cron is commonly used in operations and administration, but it can also be used elsewhere, such as downloading files and emails periodically. The word cron comes from the Greek chronos (χρόνος), meaning time.

cron expression structure#

General form#

1st2nd3rd4th5th6th
FieldMinuteHourDayMonthWeekYear
Range0-590-231-311-120-6 (Sunday is 0) (fill in ? if unsure)1970-2099

Months can also be written as JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. Days of the week can also be written as SUN, MON, TUE, WED, THU, FRI, SAT. Note: ranges must be integer values.

Special form#

Used in some places. Compared to the general form, there are no seconds or years; everything else is the same

1st2nd3rd4th5th
FieldMinuteHourDayMonthWeek
Range0-590-231-311-120-6 (Sunday is 0) (fill in ? if unsure)

Wildcards#

Generally, all values and all forms of the cron expression support wildcards.

/Meaning
*Any. For example, putting it in the month field means every month
/Step; the first value is the starting time, the second is the divisor. For example, putting 1-20 in the seconds field cycles through 1, 21, 41, 1, 21, 41 and so on
-Range; the first value is the start, the second is the end. For example, putting 1-4 in the month field means the four months 1, 2, 3, 4
,Enumeration. For example, putting 4,6,7,8 in the month field means the four months 4, 6, 7, 8

Online cron expression interpreter/generator#

https://cron.qqe2.com/

cron Expression Structure
https://tski.uk/blog/en/cron-expressions/
作者
Tokisaki Galaxy
发布于
2021-02-28
许可协议
CC BY