Incoming from Wayne Topa: > Rus Foster([EMAIL PROTECTED]) is reported to have said: > > Hi All, > > Couldn't find a decent answer to this in google but goes as follows > > > > If I have a cron job that is scheduled for the 31st of the month and the > > month we are in doesn't have 31 days would it be run on the last day of > > the month or not run at all? > > I bzip up all my mail at the end of the month and had the same > problem. I solved it by having the script run 1 minute after midnight > on the 1st of the month.
Another way is to run it every day, but have the script figure out if it's the last day of the month, and exit if not. I have no idea where I found this, nor have I tested it extensively: days_in_month () { dim_m=${1:-`date +%m`}; dim_m=`monthnum $dim_m`; case ${dim_m#0} in 9 | 4 | 6 | 11) echo 30 ;; 1 | 3 | 5 | 7 | 8 | 10 | 12) echo 31 ;; 2) is_leap_year ${2:-`date +%Y`} && echo 29 || echo 28 ;; esac } -- Any technology distinguishable from magic is insufficiently advanced. (*) http://www.spots.ab.ca/~keeling - - -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]