script for failed processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script for failed processes
# 1  
Old 03-05-2009
script for failed processes

I want to write a script that log all the failed processes and start the same process.

For that I have already write a script that gives all the PID

#!/bin/ksh
pid= `ps -ef |grep "ov" |grep -v "grep"| awk '{print $2}'`
echo $pid
if [ "$? -eq 0 ];
then
echo "process is running"
else
echo "process is not running"
fi

and o/p comes ->

19 25 40 43 44 45 46 47 48 18359 1557 2015 2016 2020 2021 2022 18236 11389 10523 12950 18239 9176 18228 29786 15867 12912 18296 24251 13650 18241 29658 16027 18307 18355 15868 18240 18305 15852 18233 18242 18243 18230 22644 15853 16003 16078 18238 18297 12728 18229 29731 16083 16097 18295 18298 19476 23290 16021


now if pid 19,18242 and 23290 is not running then hw can I log these pid in another file and start the same process??
# 2  
Old 03-05-2009
What is the string "ov" that you are searching for? Is it the username?

What exactly do you mean by failed process? A process that is not running?
# 3  
Old 03-05-2009
yeah u r right failed process is not running process.

ov is set of process starting with ov like ovstatus,ovcheck ovbhht...
# 4  
Old 03-05-2009
If a process named (or starting with) "ov" is NOT running, then "ps -ef | grep "ov"" will NOT show you any status precisely because it is NOT running.

You would have to use some other method to find out why it is not running and start them.

HTH, Smilie

Regards,

Praveen
# 5  
Old 03-06-2009
I m trying following command but still not able to find whether process has stopped or not.

ps -ef | grep $process_name | grep -v "grep" | awk '{print $9}'

hw do we check that? so that I can use that check in my script.

thnx in advance
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Script on Solaris spawning 2 processes for one shell script execution

Hi, I am having a shell script on Solaris 10 which has a while loop as shown below. #!/usr/bin/ksh # while do sleep 60 done Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
Discussion started by: chekusi
3 Replies

2. Shell Programming and Scripting

My script failed and can't fix it ?

Hi , I'd like to give you a little bit idea about my script which is used to get any generated file from remote server using ftp session then organized those file into directories based on their date ( at the end I supposed to have 1 months directories 20130401 20130402 ....20130430 ,... (27 Replies)
Discussion started by: arm
27 Replies

3. Shell Programming and Scripting

Shell script executed from Informatica ETL tool is spawning 2 processes for one script

Hi, I am having a shell script which has a while loop as shown below. while do sleep 60 done I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Discussion started by: chekusi
2 Replies

4. Shell Programming and Scripting

ksh script failed while using -x

Hi, I have a Kshell script that is failed if i am using the -x option. $ cat ListOfFiles.lst \+DATA_DM01/pudwh/datafile/dw_billing_tts_1 \+DATA_DM01/pudwh/datafile/dw_billing_tts_2 ... (2 Replies)
Discussion started by: yoavbe
2 Replies

5. SCO

-sh: fork failed - too many processes in sco unix 5.0.5

Dear experts, I have done a re-installation of sco unix openserver 5.0.5 and managed to create users. The problem am facing is that of one user logging in more than 5 times. How can i overcome this problem. the system give the error below. -sh: fork failed - too many processes in sco unix... (5 Replies)
Discussion started by: njoroge
5 Replies

6. Shell Programming and Scripting

AWK script getting failed

Hi All, Below is my code , In the code below the "If" condition is getting failed. I dont know what is getting wrong here , may be i can not use may logical operator at once or something else OR brackets under If condition are to be organised . Please help!! if ($11 == "0" &&... (1 Reply)
Discussion started by: unknown123
1 Replies

7. Solaris

Identifying and grouping OS processes and APP processes

Hi Is there an easy way to identify and group currently running processes into OS processes and APP processes. Not all applications are installed as packages. Any free tools or scripts to do this? Many thanks. (2 Replies)
Discussion started by: wilsonee
2 Replies

8. Shell Programming and Scripting

Need to start a script from the point where it failed.

Hi Guys, I have requirement where if the script fails at a particular point, then the script should run from that particular point itslf.. could anyone help me out from this.. Thanks (5 Replies)
Discussion started by: mac4rfree
5 Replies

9. Shell Programming and Scripting

Rerunning a command in a script that failed?

I have a script that occasionally has a command here and there that fails and I would like to set my script up to just re run the command if the exit code is 1. Is there a simple way to do that without if/thens or redirecting to the command again? (5 Replies)
Discussion started by: trey85stang
5 Replies

10. UNIX for Advanced & Expert Users

Monitoring Processes - Killing hung processes

Is there a way to monitor certain processes and if they hang too long to kill them, but certain scripts which are expected to take a long time to let them go? Thank you Richard (4 Replies)
Discussion started by: ukndoit
4 Replies
Login or Register to Ask a Question