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 縮寫值 : MonthWeek 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天的ab之間執行操做.
  1. <minute> <hour> <day> <month> <dow> <command>
  2. 第1列 第2列 3 4 5 6
  3. 第1列: 分鐘1~59 每分鐘用`*`或者` */1`表示
  4. 第2列: 小時1~23(0表示0點)
  5. 第3列: 日期1~31
  6. 第4列: 月份1~12
  7. 第5列: 星期0~6(0表示星期天)
  8. 第6列: 要運行的命令
相關文章
相關標籤/搜索