Cron job run every x weeks and on specific days [closed]

点点圈 提交于 2019-12-03 08:10:57

try 0 0 * * 0/2,1/2

0 and 1 are Sunday and Monday, and /2 is 'every other'

EDIT:

After more research into cron, the above is incorrect because /2 indicates the step (every other value), so 0/2 is equivalent to 0,2,4,6, and 0/2,1/2 is equivalent to 0,1,2,3,4,5,6,7 which explains why you saw it interpreted as every single day of the week.

In your example above 1/14 means starting with 1st of the month, increment by 14, yielding 1,15,29

That being said, if this were for a *nix crontab, then you could've been more granular about the schedule by having something like 0 0 * * Sun,Mon check_if_should_run.sh && the_script_to_run.sh. Using Ncrontab, I can't think of a way to set up every-other-week scenario.

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