0

How would I use crontab to run a script at 5:30AM every other Friday in January? This is the what I have if I ran it every Friday.

30 5 * 1 5

If I did every other friday, where do i put the /2? Is it:

30 5 */2 1 5

or:

30 5 * 1 5/2
Asif
  • 748
  • 3
  • 9
  • 32
  • possible duplicate of [How to instruct cron to execute a job every second week?](http://stackoverflow.com/questions/350047/how-to-instruct-cron-to-execute-a-job-every-second-week) – pilcrow Aug 28 '15 at 13:55

2 Answers2

1

check this solution here but I would recommend using two crons one for the first week and second for the third week as mentioned here.You could als use http://www.cronmaker.com/ to build crons.Hope it helps.

Community
  • 1
  • 1
Aameer
  • 1,366
  • 1
  • 11
  • 30
0

Try this

0 0 1-7,15-21 * 5

This is run 2 times a month, both on Fridays and at least a week apart.

Wolfack
  • 2,667
  • 1
  • 26
  • 50
  • This can backfire depending on the cron service. It executes at **00:00 on every day-of-month from 1 through 7 and every day-of-month from 15 through 21 and on Friday** on many services. Try different combos at [crontab.guru](https://crontab.guru/#0_0_1-7,15-21_*_5). – Richard Nov 07 '21 at 03:29
  • @Richard it worked for me, still running on my production server, no issues till now. I don't agree that it'll fail in any case. – Wolfack Nov 10 '21 at 12:09