Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Big question...

Status
Not open for further replies.

hudhwk

Programmer
Jan 28, 2003
80
MX
Hi guys,

I have a big problem, I have a process that executes after 7 PM everyday, from time to time it is suspended because of communication problems. What I need is a process that executes on background and monitors the main process. What I've been doing is every 10 mins. I create a text file with the information of the progress of the execution of the process, and I am able to know the status, in this case I need to do a script that checks if the ERROR status is in the text file, then restart the main process. I have checked the WC command but it shows the filename and I just can't find someother way.

Do you have any idea of how to solve this? Thanks in advance.

Daniel Buentello.
 
man grep

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
If it was my script........

I would kick it off, writing the PID to a file somewhere and grep for that PID every few minutes. If it's up, great, if it's not, decide if I need to start it back up.

try

ps -ef

or

ps -ef | grep $SCRIPTPID

( where SCRIPTPID equals the PID of the executed script )
 
If you're on Solaris, then [tt]pgrep[/tt] is the way to go, not [tt]ps[/tt] and [tt]grep[/tt]. Just see the man pages.

Hope this helps.
 
Thanks guys for your answers,

Let me be mor specific. I have a file named vg01.log which contains information as follows:

Code:
Group   Seq#,LDEV#.P/S,Status,Fence,   % ,P-LDEV# M
VG01    32081  167..S-VOL PSUE ASYNC ,  100    22  -
VG01    51067   22..P-VOL PSUE ASYNC ,   89   167  -
VG01    32081  17d..S-VOL PSUE ASYNC ,  100   105  -
VG01    51067  105..P-VOL PSUE ASYNC ,   98   17d  -
VG01    32081  183..S-VOL PSUE ASYNC ,  100   203  -
VG01    51067  203..P-VOL PSUE ASYNC ,   96   183  -
I have to do a process the searches this file and identifies when a PSUE status is stored, I just don't know how to search the word and then, once it is identified, be able to run the process again.

I know it is a simple IF command but don't know how to identify the PSUE with an script.

I hope this info works and thanks again for your help.

Sincerely,

Daniel Buentello
 
I have a similar situation - we have a process running which, if it fails, causes us no end of grief in cleanup time and effort.

I wrote the following script in ksh and put it in crontab every 30 minutes. The process I'm looking for is called adt_in .

Code:
#!/usr/bin/ksh
 
 /usr/local/bin/cl_stat live | /usr/bin/grep adt_in > tempchk
 FSIZE=`ls -l tempchk | awk '{print $5}'`
 if [ "$FSIZE" = "0" ]; then
         echo "Trxd process adt_in is not active.\n"

(script then sends me an urgent email about the failure)

cl_stat is a script which simply checks the live environment for running processes - so you could probably use ps in it's place. It's proprietary to our vendor so I can't share it here, sorry.

Maybe this will give you a clue ... ???

Tom

"My mind is like a steel whatchamacallit ...
 
It worked just PERFECT.

Thanks Tom.

Sincerely,

Daniel Buentello
 
Glad to be of assistance! I've learned a lot here in this (and other) forums, good to be able to share.

Take care.

Tom

"My mind is like a steel whatchamacallit ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top