Linux Crontab語法
Crontab語法
Lists
鏈表值
: 逗號,
表示並列,要依次序;Examples:"1,2,5,9", "0-4,8-12"
.
Ranges of numbers
區間值
: 連字符-
, 'a-b'表示[a, b]區間的每一個整值.
Asterisk
*
遍歷值 : *
或者*/1
表示基本單位步長
的區間值"first through last".
, 即
minute
用*表示沒分鐘
hour
用*表示每小時
day
用* 表示每日
month
用* 表示每個月
dow
用* 表示每週的這一天.
Step values /n
步長值 /n
- Conjunction with ranges與區間值複合使用 :
*/n
, n表示間隔長度. Example, "0-23/2" can be used in the hours field to specify command execution every other hour.
- Steps are also permitted after an asterisk. 步長值與遍歷值結合使用. Example so if you want to say "every two hours", you can use "*/2".
Names
縮寫值
: Month
和Week
can also be used for the "month" and "day of week" fields.
- Use the
first three letters
of the particular day
or month
(case doesn't matter). 單詞3首字母, 不分大小寫.
- Ranges or lists of names are not allowed.不能使用
區間值
和鏈表值
.
- 組合使用:
-
優先級高於/
, 如a-b/c
(day)每隔c
天的a
到b
之間執行操做.
<minute> <hour> <day> <month> <dow> <command>
第1列 第2列 3 4 5 6
第1列: 分鐘1~59 每分鐘用`*`或者` */1`表示
第2列: 小時1~23(0表示0點)
第3列: 日期1~31
第4列: 月份1~12
第5列: 星期0~6(0表示星期天)
第6列: 要運行的命令
歡迎關注本站公眾號,獲取更多信息