man 5 crontab:

           field         allowed values
           -----         --------------
           minute        0-59
           hour          0-23
           day of month  1-31
           month         1-12 (or names, see below)
           day of week   0-7 (0 or 7 is Sun, or use names)

Note: The day of a command's execution can be specified by two fields -- day of month, and day of week. If both fields are restricted (ie, are not *), the command will be run when either field matches the current time. For example, ''30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Fri-day.

来自wikipedia的说明(http://en.wikipedia.org/wiki/Crontab):

While normally the job is executed when the time/date specification fields all match the current time and date,
there is one exception: if both "day of month" and "day of week" are restricted (not "*"),
then either the "day of month" field (3) or the "day of week" field (5) must match the current day.

以设置crontab: 11 14 27 3 3 为例,下面两个类型的时间都能满足该表达式:

  1. 3月里的每一个周三
  2. 3月27日

您可能还喜欢以下文章

关于老树

就职于网易在线游戏事业部,任系统运维工程师职位,负责公司部份基础服务及MMORPG、WEBGAME、手游等的运维工作;喜欢折腾Unix/Linux、开源技术、互联网产品。
VPS 使用 vultr,欢迎使用我的 referral link,我可以得到少许返利。

相关评论

comments powered by Disqus