Here's an idea, which will probably be blasted by the smarter folks, but should work:
Wrap your job inside a script like this:
day=`date +%d`
if [ "$day" = "1" ]
then
> /tmp/runlog
fi
run_num=`wc /tmp/runlog|awk '{ print $1 '}`
if [ "$run_num" = "2" ]
then
>/tmp/runlog
{do your script or process here}
else
echo "Not Today" >>/tmp/runlog
fi
Then, create a CRON entry which only runs Monday-Friday and then only on the first 5 days:
10 11 1-5 * 1-5 /usr/local/bin/myscript
This doesn't account for Holidays, which would vary by locale anyway.
A "wrapper" script or putting a test at the start of the actual script were suggested as solutions last time this issue was raised.
Please check the CRON entry, perhaps with a test script, because I think that the following: 10 11 1-5 * 1-5 /usr/local/bin/myscript
will run at 11:10hrs on the 1st to 5th of every month and every Monday to Friday. (not 1st to 5th as long as they are weekdays)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.