Update init script to fix bug 453977

This commit is contained in:
Doug Ledford 2008-09-17 03:06:39 +00:00
parent 8cc0bf080e
commit a5e3309eed

View File

@ -19,6 +19,7 @@
prog=/usr/sbin/opensm prog=/usr/sbin/opensm
CONFIG=/etc/rdma/opensm.conf CONFIG=/etc/rdma/opensm.conf
PID_FILE=/var/run/opensm.pid PID_FILE=/var/run/opensm.pid
ACTION=$1
start() start()
{ {
@ -32,9 +33,9 @@ start()
[ -f /var/lock/subsys/opensm ] && return 0 [ -f /var/lock/subsys/opensm ] && return 0
# Start opensm # Start opensm
echo -n "Starting IB Subnet Manager:" echo -n "Starting IB Subnet Manager:"
$prog $OPTIONS > /dev/null 2>&1 & $prog $OPTIONS > /dev/null 2>&1
OSM_PID=$!
sleep 1 sleep 1
OSM_PID=`pidof $prog`
checkpid $OSM_PID checkpid $OSM_PID
RC=$? RC=$?
[ $RC -eq 0 ] && echo_success || echo_failure [ $RC -eq 0 ] && echo_success || echo_failure
@ -63,18 +64,23 @@ stop()
# Kill opensm # Kill opensm
kill -15 $OSM_PID > /dev/null 2>&1 kill -15 $OSM_PID > /dev/null 2>&1
cnt=0 cnt=0
while [ $cnt -lt 6 -a checkpid $OSM_PID -eq 0 ]; do while [ $cnt -lt 6 ]; do
checkpid $OSM_PID
if [ $? -ne 0 ]; then
break
fi
echo -n "." echo -n "."
sleep 1 sleep 1
let cnt++ cnt=$(( $cnt + 1 ))
done done
if [ checkpid $OSM_PID -eq 0 ]; then checkpid $OSM_PID
if [ $? -eq 0 ]; then
kill -KILL $OSM_PID > /dev/null 2>&1 kill -KILL $OSM_PID > /dev/null 2>&1
echo -n "+" echo -n "+"
sleep 1 sleep 1
fi fi
checkpid $pid checkpid $OSM_PID
DEAD=$? DEAD=$?
if [ $DEAD -eq 0 ]; then if [ $DEAD -eq 0 ]; then
echo_failure echo_failure