Was to turn the date math trick shown above into a script that I named 'last-day-of-month.sh':
Code:
#!/bin/bash
TODAY=`/bin/date +%d`
TOMORROW=`/bin/date +%d -d "1 day"`
# See if tomorrow's day is less than today's
if [ $TOMORROW -lt $TODAY ]; then
exit 0
fi
exit 1
Which can then be used within a crontab file as follows:
Code:
12 0 * * * last-day-of-month.sh && /run/my/cron/job.sh
I hope this is of some use to you...
-jason