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列: 要运行的命令
posted @ 2015-07-06 14:15  gaoxw0511  阅读(232)  评论(0编辑  收藏  举报