Operating System - HP-UX
1753701 Members
5130 Online
108799 Solutions
New Discussion юеВ

Shell script with "kill" ends script

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

Shell script with "kill" ends script

Hi,

I am just writing a simple little script that will stop omniback, kill any rogue omniback/DP processes and then start it back up again. The problem is that the whole script seems to exit after the "kills" and won't run the /sbin/init.d/omni start process. Any ideas?

Thanks!
6 REPLIES 6
A. Clay Stephenson
Acclaimed Contributor

Re: Shell script with "kill" ends script

Without seeing your script, I'll have to use "The Force". You may be killing the parent process especially if this is some sort of post-exec process. Frankly, I've never had to kill "rogue" omniback processes on well-patched versions of OB2/DP unless there were some sort of hardware failures.

If this were me, I would first look for and apply the latest OB2/DP patches and push them to all the clients. If the problem persists, I would detach your script from any connection with OB2/DP processes by letting your post-exec issue an "at" job and then let the post-exec exit.

Something like this in your post-exec:

at -f /opt/omni/lbin/clean_n_fixup.sh now + 3 minutes

If it ain't broke, I can fix that.
Michael Schulte zur Sur
Honored Contributor

Re: Shell script with "kill" ends script

Hi,

I have got this kind of behavior when I kill a son process of the shell script with kill -9.
I wonder if you could try a less hard method like kill -3?

greetings,

Michael
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Shell script with "kill" ends script

I shouldn't overlook the obvious. Depending upon how you are searching for and excluding PID's (or not excluding them), your script may be doing exactly what it's being told to do and issueing a kill to itself.
If it ain't broke, I can fix that.
Coolmar
Esteemed Contributor

Re: Shell script with "kill" ends script

DOH! I can't believe I did that.

Thanks Clay!
Sally
Roland Piette
Regular Advisor

Re: Shell script with "kill" ends script

Hi Sally,

Another command exists to stop omniback : omnisv -stop. So try the following lines.

omnisv -stop
kill -9 `ps -ef | sed -n '/omni/p' | sed -e '/sed/d' | awk '{print $2}' | xargs`
omnisv -start

I hope it's what you search !

Roland
Coolmar
Esteemed Contributor

Re: Shell script with "kill" ends script

see above