Cron - First Saturday of the month

Steve Alter alter at ttidca.TTI.COM
Wed Aug 15 11:46:48 AEST 1990


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".

For example, let's assume that you want the job to run at 1 a.m. on
the first Saturday of each month.  You put in a cron job to run at
12:30 a.m. on the 1st DAY of each month, and have that cron job
launch an "at" job to run at 1 a.m. on the next Saturday, which could
be as soon as 30 minutes later.  Tweak the names and numbers to your
heart's delight, but the concept remains.

The cron line (SunOS 4.x):

30 0 1 * *   /home/myacct/bin/next.Saturday

The next.Saturday script (mode 755):

at -c 0100 Sat first.Saturday.of.month

File "first.Saturday.of.month" contains... oh, you can figure it out.

-- 
Steve Alter        <alter at ttidca.tti.com>
{csun,philabs,psivax,pyramid,quad1,rdlvax,retix}!ttidca!alter
Citicorp/TTI, Santa Monica CA  (213) 450-9111 x2541



More information about the Comp.unix.wizards mailing list