croncron-task

Cron Job every second week day


I need a cron job to run every second weekday for example.

If cron job last ran on a Thursday it should run on the next Monday.

The re-run on Wednesday and again on Friday again and on Tuesday and again on Thursday bring it back to the start.


Solution

  • Run it every weekday, and have the script set a flag in a file that says whether it did the work the on the previous run. If it did, it skips the work that time and inverts the flag.