[comp.unix.internals] Cron - First Saturday of the month

rock@rancho.uucp (Rock Kent) (09/06/90)

Curt>   I'm wondering if anyone has a way of making cron run a job on the
Curt>   first Saturday of every month?  

Didn't we just do this?

1 3 1-7 * 6 /usr/local/bin/whatever

Run /usr/local/bin/whatever at 3:01 am on whichever of the first seven
days of the month happens to be a Saturday.

***************************************************************************
*Rock Kent    rock@rancho.uucp        POB 8964, Rancho Sante Fe, CA. 92067*
***************************************************************************

merlyn@iwarp.intel.com (Randal Schwartz) (09/07/90)

In article <1990Sep6.044436.3166@rancho.uucp>, rock@rancho (Rock Kent) writes:
| Curt>   I'm wondering if anyone has a way of making cron run a job on the
| Curt>   first Saturday of every month?  
| 
| Didn't we just do this?
| 
| 1 3 1-7 * 6 /usr/local/bin/whatever
| 
| Run /usr/local/bin/whatever at 3:01 am on whichever of the first seven
| days of the month happens to be a Saturday.

We did just do this, and *that* answer is wrong for system V
braindamaged cron's that OR together the dow and day fields, rather
than AND-ing them together as it has been done for all eternity before
some stupid person (at AT&T?) got ahold of it again and attempted to
"improve" the code.

Don't start the discussion again, folks.
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/

bzs@world.std.com (Barry Shein) (09/07/90)

Just run a little wrapper (a shell script would do) every night that
has your own rules for whether or not the real program should run
today. Here's a start (very generic, SYSV date can simplify this of
course):

	#!/bin/sh
	DOW=`date|awk '{ print $1 }`
	DOM=`date|awk '{ print $3 }`

	if [ "$DOW" = "Sat" -a "$DOM" -le "7" ]
	then
		DOIT
	else
		exit 0
	fi

something like that anyhow, -le 7 is probably faulty, but that's not
the point, this is advice, not custom programming.
-- 
        -Barry Shein

Software Tool & Die    | {xylogics,uunet}!world!bzs | bzs@world.std.com
Purveyors to the Trade | Voice: 617-739-0202        | Login: 617-739-WRLD