Monitor via crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Monitor via crontab
# 1  
Old 11-29-2008
Network 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
Image
# 2  
Old 11-29-2008
Where is the problem?
Just add in second cron script something like:

kill `ps auxww | grep 'your first cron task' | do some awk`
# 3  
Old 12-03-2008
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 itSmilie

help me with some soln

regards
# 4  
Old 12-03-2008
Try this:

Crontab:

Code:
0 22 * * * killscript

killscript:

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

HTH
# 5  
Old 12-03-2008
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!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Infrastructure Monitoring

Searching for Saas Monitor service which monitor my servers which are sitting in different providers

Sorry if this is the wrong forum Searching for Saas Monitor service which monitor my servers which are sitting in different providers . This monitor tool will take as less CPU as possible , and will send info about the server to main Dashboard. The info I need is CPU / RAM / my servers status (... (1 Reply)
Discussion started by: umen
1 Replies

2. Shell Programming and Scripting

Monitor Website

Hi all, i need to do the following, when i connect to my website it prints out "Welcome User", but sometimes there are errors like "dictionary not loaded" or "wrong user name or password" so i wanted to make a script that checks that login page, and if i get the Welcome massage do nothing,... (6 Replies)
Discussion started by: charli1
6 Replies

3. Hardware

Fedora 16 dual monitor - dual head - automatic monitor shutdown

Hi, I am experiencing troubles with dual monitors in fedora 16. During boot time both monitors are working, but when system starts one monitor automatically shut down. It happend out of the blue. Some time before when I updated system this happend but then I booted older kernel release and... (0 Replies)
Discussion started by: wakatana
0 Replies

4. Shell Programming and Scripting

Help with HD monitor script

Hi, I'm new to linux and I'm trying to compile a hard drive monitoring script. I've seen a few on the internet and I've attempted to stumble through but I'm stuck at my while/do scenario. I assigned the variable NUM then took the percentage from my output and cut the % so it would be just a... (6 Replies)
Discussion started by: crocyson
6 Replies

5. Shell Programming and Scripting

Monitor: Read from the monitor

Hello, I would like to write a script that use the display as an input. In the display there is a list of file. I want to use it as an array and this would be the input in my script. Does somebody know how do I make it? (2 Replies)
Discussion started by: mig8
2 Replies

6. UNIX for Dummies Questions & Answers

Looking for monitor/top

I'm new to SUN (SunOS 5.8) and I can't find any monitoring tools to check cpu, memory, disk ... performance. Previously on unix servers I have used 'top' & 'monitor' but these commands are not on the box on in the man pages. Anyone suggest equivalent commands? (1 Reply)
Discussion started by: pavelmac
1 Replies

7. Shell Programming and Scripting

Monitor File Changes

I am trying to monitor a log file and kick of a script when a change occurs. I know I could do this with a cron job and check for differences at set intervals, but I need the script to be dynamic and notify me as soon as there is a change in the log file. If anyone knows of a way to do this please... (1 Reply)
Discussion started by: goreb13
1 Replies

8. Solaris

PC monitor

In order to use a regular PC monitor would I need to do any configuration changes to my Ultra 5 box running Solaris 8 ? (1 Reply)
Discussion started by: mangolinux
1 Replies

9. UNIX for Dummies Questions & Answers

Monitor wont come on...

I know this may not be the right forum, but here goes. Last night I was playing my favorite game Everquest and my monitor goes blank... I was able to save out of my game and shut it down... My question is this: I thought my monitor had died but this morning I was able to get it to come back... (6 Replies)
Discussion started by: Kelam_Magnus
6 Replies
Login or Register to Ask a Question