1752754 Members
4891 Online
108789 Solutions
New Discussion юеВ

Re: script help

 
SOLVED
Go to solution
file system
Frequent Advisor

script help

Hi all,

I have a problem that specific process was killed.
SO, I'm going to monitor the process and restart the process.

Can you give me tips?

/usr/softforum/ssoengine/bin-engine/ssostart.sh

the process is 'sso_engined start'

and I will edit cron job every 1 hour.

2 REPLIES 2
L_Dieter
Occasional Advisor
Solution

Re: script help

Here a nice oneliner


# !/bin/ksh
[[ $(ps -ef | grep "sso_engined start" | wc -l) -eq 0 ]] && /usr/softforum/ssoengine/bin-enine/ssostart.sh


Best regards
James R. Ferguson
Acclaimed Contributor

Re: script help

Hi:

Rather than 'grep'ing the output of the process table, pick your target process thusly:

# [ -z "`ps -C sso_engined -o pid=`" ] && /usr/softforum/ssoengine/bin-engine/ssostart.sh

Thus, if there is no process matching your command (basename) then script to start it is run. The equal sign ("=") after the 'pid' suppresses the 'ps' header. Hence if the expression evaluates to an empty one, your script is run.

Regards!

...JRF...