[Techtalk] Age-old cron problem
Mike
kenziem at sympatico.ca
Tue Dec 11 00:51:49 UTC 2007
On December 10, 2007 12:20 pm, Nicoya Helm wrote:
> > -------- Original Message --------
> > Subject: Re: [Techtalk] Age-old cron problem
> > From: Conor Daly <c.daly at met.ie>
> > Date: Mon, December 10, 2007 10:33 am
> > To: techtalk at linuxchix.org
> >
> > On Mon, Dec 10, 2007 at 06:54:44AM -0700 or thereabouts, Nicoya Helm
wrote:
> > > I think I will try this approach: via script, write a date to a file
> > > somewhere on the starting Sunday as a reference for a counter. In that
> > > same script, put in logic to increment the date counter by one (i.e.
> > > day) then test to see if we have reached the max (14 days). If we
> > > have, run the required Every-Other-Sunday-action, then reset counter.
> > > Rinse and repeat. This will still require a manual kick-off on the
> > > first Sunday, but after that should run every 14 days, i.e. every other
> > > Sunday.
you might want to check out Remind
Remind is a sophisticated calendar and alarm program.
* A sophisticated scripting language and intelligent handling of
exceptions and holidays.
http://www.roaringpenguin.com/products/remind
David, demonstrated it calculating garbage pickup days and being able to
adjust for holiday automatically.
> > You might consider 'date +"%U"' which gives a week (in the year) number.
> > You could then test if the week number is odd or even and trigger on
> > that. That avoids the possibility that a day could be missed pushing your
> > script out to run on a Monday instead of Sunday...
> >
> > Conor
> > --
>
> I stumbled across a similar suggestion shortly after sending my last
> email. Not sure how I missed it in my first searches, but it works well
> - wish I'd thought of it myself :). Here's what I tested (found at
> http://sysunconfig.net/aixtips/cron_trick.txt)
> ____________________
> WK=`date +%W`
> ON_WK=`expr $WK % 2`
>
> # to test for and execute on odd week, uncomment the =1 line
> # to test for and execute on even week, uncomment the =0 line
>
> #if [ $ON_WK = 1 ]
> if [ $ON_WK = 0 ]
> then
> echo $BODY |mailx -s "test email" user at email.com
>
> fi
> ____________________
>
>
> ~~~Nicoya...
> ---KC0VVR---
> "It is never too late to be what you might have been." --George Eliot
>
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
--
Collector of vintage computers http://www.ncf.ca/~ba600
More information about the Techtalk
mailing list