我想让脚本每5分钟运行一次,比如说从13:02开始运行,这样我可以让每5分钟运行另一个脚本,但是从13:04开始运行,因此第二个脚本在第一个脚本开始运行两分钟后运行工作。我该如何实现?
I would like to have a script run every 5 minutes let's say starting from 13:02 so I can have another script runs every 5 minutes but starting from 13:04 so the second script runs two minutes after the start of the first job. How can I achieve this?
推荐答案使用此方法:
*/5+2 * * * * 1st-script */5+4 * * * * 2nd-script供将来参考,请在线查看此 Cron Job Generator 。
For future reference take a look at this online Cron Job Generator.
由于有一些报告称 + 语法在Ubuntu上不起作用14.04,这是一个变化形式:
Since there are several reports that the + syntax is not working on Ubuntu 14.04, here's a variation:
2-59/5 * * * * 1st-script 4-59/5 * * * * 2nd-script这将导致第一个脚本每5分钟运行一次,偏移量为2分钟每个小时的开始,第二个脚本的行为相同,但偏移量为4分钟。
This will result in the 1st script to run every 5 minutes starting with an offset of 2 minutes at the beginning of each hour and the 2nd script to behave the same with an offset of 4 minutes.
更多推荐
从0分钟以外的时间开始,如何每5分钟执行一次cron作业?
发布评论