以下是cron的格式

时间:2014-03-07 11:46:11

标签: cron cronexpression

我需要在2nd Sat of the month at 11pm运行bash脚本。我无法弄清楚它的cronformat。

* * * * * *
| | | | | | 
| | | | | +-- Year              (range: 1900-3000)
| | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)

这是我从互联网上找到的cronformat,但我是新手,我觉得这个问题很难实现。

2 个答案:

答案 0 :(得分:0)

Arg我等待了很多天的解决方案,但没有一个评论也没有答案。无论如何,我认为答案是

0 23 8-14 * Sat
如果我错了,请纠正我。

答案 1 :(得分:0)

每周六运行cron,只在第二个星期六执行脚本:

* * * * 6 * test $(expr $(date +\%d) / 7) -eq 2 && <execute script here>