Operating System - HP-UX
1836225 Members
1814 Online
110096 Solutions
New Discussion

Re: /sbin/init.d/sysedge stop flakey

 
SOLVED
Go to solution
Ratzie
Super Advisor

/sbin/init.d/sysedge stop flakey

I have trying to stop and start sysedge on my hp 11.00 server, this could have been going on for a while, but i only now really noticed it.
It is flaky at best, sometimes it works sometimes no.

I run it as root
and all I get back is...

# /sbin/init.d/sysedge stop
Killed
# ps -ef |grep sysedge
root 7469 1 0 11:54:57 ? 0:00 /opt/EMPsysedge/bin/sysedge -b -p 161 -l /etc/sysedge.l

From looking at the /sbin/init.d/sysedge file it should say...

SystemEDGE stopped

Is there something I am missing?
I really don't understand the...
if kill -9
Is it killing the process? Where does it get Killed from?

...taken from /sbin/init.d/sysedge...
'stop')
#
# Determine PID of process(es) to stop
#
MYPID=`ps -ef | grep sysedge | grep -v grep | awk '{print $2}'`
if [ "X$MYPID" != "X" ]; then
if kill -9 $MYPID; then
echo "SystemEDGE stopped"
else
set_return
echo "Unable to stop SystemEDGE"
fi
fi
;;
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: /sbin/init.d/sysedge stop flakey

First of all, there is a big hole in your logic. If the pid is not found then you exit in an indeterminate state. Secondly, kill -9 should only be used as a weapon of last resort because it does not allow the process to do any cleanup (e.g. remove temp files, clean up shared memory and/or semaphores). You should first try a kill -15 then a -1, -2, -3, then probably -11, and finally -9. Do this between each of the kill's

kill -0 ${PID}
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "Still a valid PID; kill some more"
else
echo "Process gone"
fi


If it ain't broke, I can fix that.
Ratzie
Super Advisor

Re: /sbin/init.d/sysedge stop flakey

The funny thing is that I did not create this script, this what sysedge sent.

I was wondering if I need to modify it?

A. Clay Stephenson
Acclaimed Contributor

Re: /sbin/init.d/sysedge stop flakey

I really don't care who wrote it; I stand by my original comments. You might try manually killing the process by sending various signals. That would let you send a smaller set of escalating kills. Kill -9 is almost always a bad idea.
You at least need to set a sensible return code when the pid is not found.
If it ain't broke, I can fix that.