Cron - First Saturday of the month

Tim Evans tkevans at fallst.UUCP
Sun Aug 19 00:32:55 AEST 1990


In <19137 at ttidca.TTI.COM> alter at ttidca.TTI.COM (Steve Alter) writes:

>In article <19744 at orstcs.CS.ORST.EDU> curt at oce.orst.edu (Curt Vandetta) writes:
>}   I'm wondering if anyone has a way of making cron run a job on the
>}   first Saturday of every month?  

>I'm going to totally side-step the fight that has been waged over
>whether the day-of-week is logically ANDed or ORed with the day-of-month.

>You can set it up using a combination of cron and "at".

You can also let the job itself figure out what day it is and decide
whether to run.  The following fragment is from a script which is
run _every_ Wednesday on my system; depending on the day of the
month, it does different things.  (Specifically, on the 2nd Wednesday
of the month, it does one thing, on the 3rd Wednesday, it does something
else, and on all other Wednesdays, it does nothing.)

# extract 3rd field of output from date command
set `date`
TODAY=$3
case "$TODAY" in
	8|9|10|11|12|13|14)	# it's the 2nd Wednesday; send reminder
				echo "FOO DISTRIBUTION NEXT WEEK
------------------------------
This is to remind you that the regular monthly distribution of foo
will take place next Wednesday.

If you have any corrections/updates, please send your updates
no later than close of business Friday.

If you have any questions, please contact so-and-so" | mail aliaslist;;
	# it's the 3rd Wednesday; do it!
	15|16|17|18|19|20|21)
		DistMachDb;;		# call shell function to do distribution
	# it's any Wednesday other than 2nd or 3rd, so just quit
	*)	exit 0;;
esac
-- 
UUCP:		{rutgers|ames|uunet}!mimsy!woodb!fallst!tkevans
INTERNET:	tkevans%fallst at wb3ffv.ampr.org
Tim Evans	2201 Brookhaven Ct, Fallston, MD 21047



More information about the Comp.unix.wizards mailing list