croncron-taskcrontrigger

Cron job for running task every second week


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


Solution

  • 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