I have below crontab scheduled for Saturday that falls between days 19-23, I' m not sure why it ran on 20th (Friday). Any guesses?
00 21 19-23 * 6 <command>
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
That Cron expression translates to:
At 21:00 on the 19, 20, 21, 22 and 23rd of every month and every Saturday.
So it explicitly told cron to run on Friday the 20th. This is because of:
When the schedule specifies both date and weekday, they're combined with a logical OR, i.e. the job will run if current_minute == scheduled_minute && current_hour == scheduled_hour && current_month == scheduled_month && (current_day == scheduled_date OR current_weekday == scheduled_weekday).
This information is from this handy Cron tool: http://crontab.guru/
To make your job to run on given days when it is Saturday you could use:
00 21 19-23 * * test $(date +%u) -eq 6 && command
This solution is from crontab day of week vs. day of month?