What's the cron (linux) syntax to have a job run on the 2nd and 4th Saturday of the month?
Expanding on @paxdiablo's reply, why not just put the addition into the crontab, instead of the script?
#m h dom mon dow command
0 1 8-14,22-28 * * [ `date +\%u` = 6 ] && /path/to/myscript
Note the backslash before %u, which is not needed when you try this on the command line, but it is needed in a crontab entry to ensure the shell gets to see the whole command.
Doing it this way puts all the logic for selecting the proper day in the place your colleagues first look at, and you can run the script manually on another day if the need arises.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With