You can use this script. It generates the crontab line that you can use to configure cron for the current month. It takes leap years into account thanks to the script found here:
http://bash.cyberciti.biz/
I just got the script and made the adjustments necessary to make your desired function.
Main Topics
Browse All Topics





by: nociPosted on 2009-08-06 at 03:29:33ID: 25031729
there are two aproaches:
1) use cron (is problematic in case of 29th of february), you might update the crontab every year at beginning of the year.
0 0 31 1,3,5,7,8,10,12 * runscript
0 0 30 4,6,9,11 * runscript
0 0 28 2 * runscript
0 0 15 * * runscript
2) run a script and have the script check if the next DAY is 1....
0 0 15,28-31 * * runscript
in runscript use the date command with various formats the check the current date (15) to run
and the if the next date. You might need a small script to return the the date of current time +86400 seconds.