I am trying to write a script that will check the cron log file and email the status if the cron job has run completed execution or failed.. This is what the cron process appends to the cron log once the job has executed
> CMD: /u/cm_clr.sh
> root 3737 c Tue Mar 30 18:11:00 2004
< root 3737 c Tue Mar 30 18:30:23 2004
I am currently in a problem here where I want to grep "/u/cm_clr.sh" then also go to next line and grep the date and pid line so when i try
#cat log1 | grep /u/cm_clr.sh Tue Mar 30 18:11:00 2004
it does not output both lines.. any other way of achieving this would be very welcome as all i want is to get notified when cron job started and when it completeted.. for every job
I have tried your script and it works fine only there is a slight issue with the script respawning iself also several instances of "tail" command has been spawned. Would there be any reason behing awk doing this, also there are some instances of the script that has the /etc/cron process as its PPID?? Any suggestions to fix this.
I don't understand how you can get this result.
Did you run the script from the shell prompt or from a script ?
In that last case verify that the script is not called by another script (directly or indirectly)
How do I run the script so that it stays in memory as a process and does not exit when I exit the terminal. The problem was that I ran it as a cron job as a result cron was spwaning new instances as the scheduled time.
I need to make sure that the variables in this script are not set outside this script. How do I check that all the variables in this script are set only within this script and not applied globally as this could have disasterous effects on other applications and scripts