[HPADM] SUMMARY:Cron help

From: Whittemore, Dale (dale.whittemore@lmco.com)
Date: Wed Nov 26 2003 - 13:53:27 EST


Thanks to all who answered, to many to list.
Several methods, including the one I am currently using were suggested.

What I decided to use is the one I am currently using:

dow=`date +%a`
dom=`date +%d`
if [[ $dom -lt 8 ]] && [[ $dow = Sun ]]
then
  ......
else
  ......
fi

Happy Thanksgiving to all who celebrate it.

Dale A. Whittemore
Computer Systems Analyst, Senior
Lockheed Martin Enterprise Information Systems
Denver, Colorado

-----Original Message-----
From: hpux-admin-owner@DutchWorks.nl
[mailto:hpux-admin-owner@DutchWorks.nl]On Behalf Of Whittemore, Dale
Sent: Tuesday, November 25, 2003 10:12 AM
To: hpux-admin@DutchWorks.nl
Subject: [HPADM] Cron help

I think I know the answer to this one but I wanted to check with the rest of you.

Given the following line in the crontab file:

min hour dom mon dow script to run
00 18 1-7 * 0 /usr/local/bin/<script>
00 18 8-31 * 0 /usr/local/bin/<script2>

<script> will run at 6:00pm the first 7 days of the month then every Sunday there after?
I tried the above in the cron starting on 11/20 and <script2> ran from the 20th thru the 23rd before I caught it.

What I was hoping to accomplish is for <script> to run on the first Sunday of the month and have <script2> run the other Sundays. Is there a way, using the cron, to accomplish what I was hoping for? Buying a third party job scheduling package would be nice but is not an option at this time.
I have already modified <script> to do a check of the day-of-week and day-of-month and if it is Sunday and the day-of-month is less than 8, execute otherwise exit.

Thanks

Dale A. Whittemore
Computer Systems Analyst, Senior
Lockheed Martin Enterprise Information Systems
Denver, Colorado

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:36 EDT