更新时间:2023-01-24 16:37:55
0
和 7
都代表星期天,你可以用你想要的,所以写0-6 或 1-7 具有相同的结果.
0
and 7
both stand for Sunday, you can use the one you want, so writing 0-6 or 1-7 has the same result.
此外,正如@Henrik 所建议的,可以通过缩短的日期名称来替换数字,例如 MON
、THU
等:
Also, as suggested by @Henrik, it is possible to replace numbers by shortened name of days, such as MON
, THU
, etc:
0 - Sun Sunday
1 - Mon Monday
2 - Tue Tuesday
3 - Wed Wednesday
4 - Thu Thursday
5 - Fri Friday
6 - Sat Saturday
7 - Sun Sunday
图形上,* * * * * 要执行的命令
代表:
分钟 | 小时 | 一个月的第几天 | 月 | 星期几 | |
---|---|---|---|---|---|
(0-59) | (0-23) | (1-31) | (1-12) | (1-7) | |
* | * | * | * | * | 要执行的命令 |
或者使用旧样式:
┌────────── minute (0 - 59)
│ ┌──────── hour (0 - 23)
│ │ ┌────── day of month (1 - 31)
│ │ │ ┌──── month (1 - 12)
│ │ │ │ ┌── day of week (0 - 6 => Sunday - Saturday, or
│ │ │ │ │ 1 - 7 => Monday - Sunday)
↓ ↓ ↓ ↓ ↓
* * * * * command to be executed
最后,如果要逐日指定,可以用逗号分隔几天,例如SUN,MON,THU
只会在星期日执行命令,星期一在星期四执行.
Finally, if you want to specify day by day, you can separate days with commas, for example SUN,MON,THU
will exectute the command only on sundays, mondays on thursdays.
您可以在 ***关于 Cron 的文章 中阅读更多详细信息,并使用 crontab.guru.
You can read further details in Wikipedia's article about Cron and check a cron expression online with crontab.guru.