LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-14-2011, 08:07 AM   #1
kais1
Member
 
Registered: Dec 2008
Posts: 61

Rep: Reputation: 17
Monitor process duration


Dear all,

We have the below script, to check the process MEDT, if it doesn't run , then it will send a message immediately. the
same script, if I want to check if it is continously running for more than 1 hour, then it should do the action mentioned
below.



#/bin/ksh
#Develop By
#Date :

EXIT=`ps -ef | grep -v grep | grep -c "MEDT E7 N MEDFT 40"`
if [ $EXIT = 0 ]
then
/opt/OV/bin/OpC/opcmsg application="CONNECT" object="MEDT E7 N MEDFT 40" service_id="CONNECT:MEDT E7 N MEDFT-40" severity=critical msg_text="Process MEDT E7 N MEDFT 40 is not running" msg_grp="INTECONNECT"
fi


Thanks
Kai
 
Old 06-14-2011, 08:30 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
You could test whether it is running as the script already does and also note its PID. The script could then sleep for an hour and test again in the same way; if the test finds the same process (same PID) then it has run for an hour and the script can then do whatever you want.
 
1 members found this post helpful.
Old 06-14-2011, 08:52 AM   #3
kais1
Member
 
Registered: Dec 2008
Posts: 61

Original Poster
Rep: Reputation: 17
Thanks Guru.

Thats a great idea. using PID

Can I have a sample script ?. I know I should not ask for the complete scripts. Some hints . Then I will break my head to form a complete one .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Monitor a Process linuxaddict7 Linux - Server 4 09-08-2009 09:40 AM
Process monitor $@ya Programming 5 09-15-2005 11:57 AM
monitor process iclinux Programming 3 01-16-2005 02:00 PM
process monitor iclinux Programming 6 01-14-2005 09:35 PM
How do I monitor a process? mad_ady Linux - General 5 11-07-2003 09:15 AM


All times are GMT -5. The time now is 08:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration