You want to set up a crontab where something happens every weekday morning, i.e. 8 am every Monday, Tuesday, Wednesday, Thursday, and Friday in January from the 10th to the 30th. You set up your crontab with the following
0 8 10-30 1 1-5 /usr/local/bin/myscript
and it runs every single day from the 10th to the 30th AND Monday through Friday on the 1st to the 9th and the 31st (given that the 31st is on a Monday -Friday)
Yup. That is how it works. If it is date is the 10th through the 30th or it is Monday through Friday it will run. To get around it you have to:
0 8 10-30 1 * test $(date +\%u) -gt 0 && (test $(date +\%u) -lt 6 && (/usr/local/bin/myscript))
The above is run from the 10th to the 30th in January at 0800 – then it tests to make sure it is after Sunday and before Saturday – then if so – run my script.
I personally found this out the hard way. Hope this helps you!!
Side note – watch the parentheses () – if you miss one it will break!