Question

Jay R. Ashworth jra at baylink.com
Fri Jan 14 12:23:37 PST 2005


On Fri, Jan 14, 2005 at 03:19:19PM -0500, Fairlight wrote:
> At Fri, Jan 14, 2005 at 02:43:52PM -0500 or thereabouts, 
> suspect Courtney was observed uttering:
> > Guys AND Gals
> > 
> > One of the reps here wants a report every other Friday...I was thinking of
> > getting week number and dividing by two, if there is a remainder, than dont
> > select...any other ways?  BTW...we run on UNIX so it would be a cron job...
> 
> My approach would be a bit unconventional compared to how Jay was trying to
> do it, but I'd use conditional logic as illustrated by the pseudo-code below:
> 
> if runfile exists
>      run report
>      remove runfile
>      end
> if runfile does not exist
>      create runfile
>      end
> 
> ....And I'd simply set this logic to run -every- Friday.  No worrying about
> dates, etc.  It just flip-flops.

Yeah, that would work.  :-)  

Or you could use the %U or %V switches to date, and expr to do modulo 2
math to decide whether to run:

[ `expr \`date +%U\` % 2` = 1 ] && dreport blah yada yada

I *think* I have that right; I haven't tested it.  (It's difficult to
test things which only change every 7 days.  :-)

Cheers,
-- jra
-- 
Jay R. Ashworth                                                jra at baylink.com
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274

      If you can read this... thank a system adminstrator.  Or two.  --me


More information about the Filepro-list mailing list