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

Michael H. Warfield mhw at WittsEnd.com
Sat Aug 27 14:41:16 EDT 2011


On Sat, 2011-08-27 at 12:47 -0400, Geoffrey Myers wrote: 
> 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

You're work'n too hard...

DCODE=`date +%u%d`

if [[ ${DCODE} -gt 607 && ${DCODE} -lt 615 ]]
then
echo "2nd Saturday"
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
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
> 

-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20110827/e7970e69/attachment.bin 


More information about the Ale mailing list