Cron job for running task every second week

二次信任 提交于 2019-12-13 03:54:17

问题


I want to create cron job for external application to run every second week starting from Thursday

Eg -

9:00 pm,23/5/2019

9:00 pm,6/6/2019

Cron Expression which I can modify

0 0 0 0 0 0
Minute | Hour | Day of Month | Month | Day of Week | Year

I already tried different combinations but not able to receive this functionality

Site I used

https://crontab.guru/

Cron Expression

0 0 0 0 0 0

Minute | Hour | Day of Month | Month | Day of Week | Year


回答1:


There is no exact method to run the script every two weeks.

For alternatively you can use logic in the external application(script) to decide whether run the script or not. Then you can schedule the Cron to run in every week.

ex: 0 21 * * 4

Above Cron will run in every Thursday of week at 9 PM.

Please refer the below for more info. https://www.systutorials.com/39652/how-to-run-a-cron-job-every-two-weeks-months-days/

From the script level you can decide whether to run the script or not



来源:https://stackoverflow.com/questions/56270391/cron-job-for-running-task-every-second-week

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