Re: CRON jobs fails - what should be done ---

From: Bruce Harvey (BruceH@ROUTESCAPE.COM)
Date: Wed Aug 07 2002 - 09:33:26 EDT


There are ways to do this, usually involving disk-based "flag" files (whose
existance or lack thereof means something to the script).

For example, your crontab says you run your script at 7:00 AM AND 9:00 AM.

Every night at midnight, and upon every boot (just in case), you delete the
file called /Mydir/MyFlagFile.

7:00 AM rolls around, and your script checks for /Mydir/MyFlagFile. It
doesn't find it, so it does what it needs to do. When it finishes
successfully (it must be able to tell this ... won't work if it "bombs"), it
touches /Mydir/MyFlagFile (must have permission to do this, too).

9:00 AM rolls around, and your script checks for /Mydir/MyFlagFile. It
finds it, so it exits.

If the 7:00 AM fails, then it sends you a message. You receive this, and
know that the 9:00 AM may pick it up. If the 9:00 AM fails, you know you
need to get in there and do it.

Other versions of this method exist, putting values in the file no matter
what, to indicate what failed, where it failed, and so on and so forth, but
the above is the simplest and least troubleprone. Works on all UNIX
systems, no matter what facilities they have, too.

---------------------------------------
Bruce T. Harvey, Special Projects Developer
bruceh@routescape.com, www.routescape.com
Insight Distribution Systems --- Hunt Valley, MD

-----Original Message-----
From: Mondal, Subrata [mailto:SMondal@IMF.ORG]
Sent: Wednesday, August 07, 2002 9:15 AM
To: aix-l@Princeton.EDU
Subject: [aix-l] CRON jobs fails - what should be done ---

Hi:

I have a cron job and if it fails I get an email.
I want this way:
My cron job runs at 7:00 am every morning - runs ok - End
                                                         - fails - run
again at 9:00 am - runs - OK - End
                                                   else

manual intervention reqd.

Is this possible
( Basically to run the failed job once again at another time thru
script)

Thanks
Subrata



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:07 EDT