I have five servers running an eventstore cluster. I want to run a crontab command on each one on separate days.
- Run on Monday
- Run on Tuesday
etc
But I also want to run a different command on the fourth week of every month.
I set them up like this, thinking it should work - and checking crontab.guru confirmed what I thought should happen;
Machines 1-5:
- 30 6 1-21 * Mon /first-command-to-run
- 30 6 1-21 * Tue /first-command-to-run
- 30 6 1-21 * Wed /first-command-to-run
- 30 6 1-21 * Thu /first-command-to-run
- 30 6 1-21 * Fri /first-command-to-run
Then a similar command on each for the Week 4 command:
- 30 6 22-29 * Mon /week4-command-to-run
(repeat DOW as above)
So for today - Friday the 19th, I wanted just machine #5 to run /first-command-to-run at 0630 and for the other four to do nothing.
I was fairly confident this would work as expected, but it seems all five machines ran /first-command-to-run this morning, instead of just Friday's machine.
None ran the /week4-command-to-run though, so the day of month falling outside of the 22-29 range is correctly preventing that.
I'm now wondering if by specifying the day-of-month range, this is causing cron to disregard the Day-of-Week. Could that be the case? If not, what am I doing wrong?
Os is Rocky 8.4
(Note: I'm aware and okay with the fact that the exact day-of-months might fall outside the strict weeks.)