[lug] Automatic removal of cron job by cron script

karl horlen horlenkarl at yahoo.com
Fri Nov 2 17:10:31 MDT 2007


I've created a cron job script called 'monitor' that
monitors the health of a hardware component.  When an
error is detected, I want this script to:

1) Call another script called 'alert' to send a
repeating error message (using an endless loop with
sleep 2) to the console as an alert for staff.  

THEN

2) Remove the original cron JOB (remove the entry from
the crontab file from within the original cron script
'monitor') versus just killing the actual running
script 'monitor'.  If I don't remove the job, it will
keep spawning more 'monitor' processes and I will have
only killed the last process.

I don't need the cron to run any longer because my
'alert' script will now be running and sending output
to the console.

how do I automate removing a sinble cron job from cron
via script?

Friday afternoons are not usually good days to ask
questions but I thought I'd give it a try.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the LUG mailing list