Monitor via crontab

Hi ,

I have a configuration file which i have to monitor via a crontab.
Now i should be able to control the first cron job via a second one i start depending on the start time and stop time in config file.

say if the starttime is 10:00 AM and stop time is 12:00 Noon , i have to start the second cron job by 10:00 and kill the first cron job by 12.

i need to write a shell / perl script for this.

kindly help;

regards
rvenkam

Where is the problem?
Just add in second cron script something like:

kill `ps auxww | grep 'your first cron task' | do some awk`

thanks for the reply.

i have added a cron entry to monitor the appln in the crontab file like this
0 0 * * * <path where appln file is present>

The appln will strt at 12 midnight everyday and has to stop by 10 PM the same day.

now i added another cron job for running a acript which wil monitor the appl till 10 like this
and which will be started some ten mins before 10 PM everyday

50 22 * * * <path of the script>

TIME_NOW=date '+%H:%M:%S'
if [$TIME_NOW == "22:00:00"] ; then
ps -ef |grep "<appl name> "
kill -9 | awk '$2'
exit 1
fi

But the problem here is allthe cron jobs are shown rnning as /usr/sbin/cron if i grep for cron.
So how do i kill my cron job?
I tried invoking a child job along with the first cron, get its parent id (which wil be cron job id) and kill it.
But that seems to be a round about way of doin it:(

help me with some soln

regards

Try this:

Crontab:

0 22 * * * killscript

killscript:

kill -9 `ps -ef | grep <path to script started at midnight> |  awk '{ print $2 }' `

HTH

kill -9 `ps -ef | grep <path to script started at midnight> | awk '{ print $2 }'

but this will kill the appln itself and not the cron job associated with it!

correct me if my understanding is wrong!