Execute a Cronjob Every Minute Between Two Times

六眼飞鱼酱① 提交于 2019-12-12 05:45:46

问题


I need to run a bash script in crontab every minute between 8:45am and 9:50am of every day.

Code:

45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 8 * * * /home/pull.sh > /home/logs/pull.log 2>&1
00/50 9 * * * /home/pull.sh > home/logs/pull.log 2>&1

Is this correct and/or the most efficient way to do this?


回答1:


Try this:

45-59/1 8 * * * /home/pull.sh > /home/pull.log 2>&1
00-50/1 9 * * * /home/pull.sh > /home/pull.log 2>&1



回答2:


http://www.nncron.ru/help/EN/working/cron-format.htm

According to that website, you can do something like this:

45-59 8 * * * /home/pull.sh > /home/logs/pull.log 2>&1

I'm not certain what you're looking to do with this line:

00/50 9 * * * /home/pull.sh > home/logs/pull.log 2>&1

I actually don't know what that will do.



来源:https://stackoverflow.com/questions/34959925/execute-a-cronjob-every-minute-between-two-times

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!