您的位置:首页 > 运维架构 > Linux

Linux Crontab语法

2015-07-06 14:15 555 查看

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列: 要运行的命令
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: