Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-14-2011, 09:07 AM   #1
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

#Develop By
#Date :

EXIT=`ps -ef | grep -v grep | grep -c "MEDT E7 N MEDFT 40"`
if [ $EXIT = 0 ]
/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"

Old 06-14-2011, 09:30 AM   #2
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
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, 09:52 AM   #3
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 .


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 10:40 AM
Process monitor $@ya Programming 5 09-15-2005 12:57 PM
monitor process iclinux Programming 3 01-16-2005 03:00 PM
process monitor iclinux Programming 6 01-14-2005 10:35 PM
How do I monitor a process? mad_ady Linux - General 5 11-07-2003 10:15 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:29 PM.

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