thunderw
2021-05-14 17:19:59 +08:00
man 5 crontab 可知,时间字段的含义如下
The time and date fields are:
field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sunday, or use names)
Note: The day of a command's execution can be specified in the follow‐
ing two fields — 'day of month', and 'day of week'. If both fields are
restricted (i.e., do not contain the "*" character), the command will
be run when either field matches the current time. For example,
"30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st
and 15th of each month, plus every Friday.
如手册所言,星期和日期两个都指定的话,他们是或的关系,是并集。你举的例子表示周一到周三到或 4 号。
但是手册又说了,按名字不能指定范围啊 mon-wed 应该是不行的啊…… 我认为要写 1-3
Names can also be used for the 'month' and 'day of week' fields. Use
the first three letters of the particular day or month (case does not
matter). Ranges or lists of names are not allowed.