2
rated 0 times
[
2]
[
0]
/ answers: 1 / hits: 2269
/ 1 Year ago, fri, december 9, 2022, 11:06:24
How do I define crontab date for second Wednesday (of every months) only? I would appreciate your help.
More From » cron
How do I define crontab date for second Wednesday (of every months) only? I would appreciate your help.
You asked for cron so only using cron you can do this using bash's date as a 2nd test:
0 0 8-14 * * [ "$(date '+%u')" = "3" ] && {your script}
The comment from Soren A is a little wrong (BUT the man page is also wrong). 0 0 8-14 * WED
= “At 00:00 on every day-of-month from 8 through 14 and on Wednesday.” From the last link:
Tip 1: If the day-of-month or day-of-week part starts with a *, they form an intersection. Otherwise they form a union. * * 3 * 1 runs on the 3rd day of the month and on Monday (union), whereas * * */2 * 1 runs on every second day of the month only if it's also a Monday (intersection). The manpage is incorrect about this detail. More info.