在Unix中以30分钟开始一个cron作业

时间:2022-09-15 19:12:49

I want to run a cron job for every 2 minutes from 9:30 to 12.How should I do it?

我想从9:30到12每隔2分钟完成一次cron工作。我该怎么做?

Is this correct? Where should I add 30?

它是否正确?我应该在哪里加30?

*/2  9-12   *   *   *

1 个解决方案

#1


You'll actually need two cronjobs. Add 30-59 in the place of the first asterisk, for execution from 9:30 until 10: 30-59/2 9 * * *. And then a second one for execution from 10:00 until 12:00 */2 10-12 * * *

你真的需要两个cronjobs。在第一个星号的位置添加30-59,从9:30到10:30-59 / 2 9 * * *执行。然后是第二个执行从10:00到12:00 * / 2 10-12 * * *

Easy tool to check: http://cronchecker.net/check?statement=30-59%2F2+9-12+++*+echo+yep So the whole thing will be something like:

易于检查的工具:http://cronchecker.net/check?statement = 30-59%2F2 + 9-12++++++ echoo+yep所以整个事情将是这样的:

30-59/2 9 * * * echo yep
*/2 10-12 * * * echo yep

#1


You'll actually need two cronjobs. Add 30-59 in the place of the first asterisk, for execution from 9:30 until 10: 30-59/2 9 * * *. And then a second one for execution from 10:00 until 12:00 */2 10-12 * * *

你真的需要两个cronjobs。在第一个星号的位置添加30-59,从9:30到10:30-59 / 2 9 * * *执行。然后是第二个执行从10:00到12:00 * / 2 10-12 * * *

Easy tool to check: http://cronchecker.net/check?statement=30-59%2F2+9-12+++*+echo+yep So the whole thing will be something like:

易于检查的工具:http://cronchecker.net/check?statement = 30-59%2F2 + 9-12++++++ echoo+yep所以整个事情将是这样的:

30-59/2 9 * * * echo yep
*/2 10-12 * * * echo yep