[ale] cron entry that runs the 2nd saturday of every month

Geoffrey Myers lists at serioustechnology.com
Sat Aug 27 12:47:33 EDT 2011


Michael H. Warfield wrote:
> On Fri, 2011-08-26 at 16:47 -0400, Erik Mathis wrote: 
>> I ran into this same issue, and iirc cron uses a AND to compare dates.
>> I ended up running it every Monday and added a wrapper to the script
>> to decide if its the right day to do this function. If not, just exit.

Here's what I think is a workable solution:

set $(date +"%d %u")

monthday=$1
weekday=$2

if [ $weekday -eq 6 ]; then

     case $monthday in
         8 | 9 | 10 | 11 | 12 | 13 | 14)

             echo it is the 2nd saturday
             ;;
     esac
fi

-- 
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson


More information about the Ale mailing list