Merge "Update SM lsb script for quick start"
This commit is contained in:
commit
cf4015918c
|
@ -55,19 +55,52 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Starting ${SM_NAME}: "
|
echo -n "Starting ${SM_NAME}: "
|
||||||
if [ -n "`pidof ${SM}`" ]
|
c=0
|
||||||
then
|
p=$(pidof ${SM})
|
||||||
# PMOND might have restarted SM already.
|
# pidof /usr/bin/sm return 2 pids. When SM main process is killed
|
||||||
RETVAL=0
|
# subprocess id is returned until the subprocess goes away.
|
||||||
else
|
# calling start-stop-daemon --start too early will fail
|
||||||
|
#
|
||||||
|
# Add a loop below to wait up to 10 seconds for sub process to finish.
|
||||||
|
# Sub process terminates in around 5 seconds by itself, try killing it.
|
||||||
|
# A slight longer wait time to see main process goes away is not a concern,
|
||||||
|
# as if the SM is actually running (possibly started by pmon or systemd),
|
||||||
|
# sm is already functioning.
|
||||||
|
c=0
|
||||||
|
p=$(pidof ${SM})
|
||||||
|
while [[ $c -lt 10 && ${p} ]]
|
||||||
|
do
|
||||||
|
logger "SM waiting ${p}"
|
||||||
|
if [[ $(echo ${p} | grep "^[0-9]*$") ]]; then
|
||||||
|
# only subprocess running, try killing it
|
||||||
|
kill -9 ${p}
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
c=$(( ${c} + 1 ))
|
||||||
|
p=$(pidof ${SM})
|
||||||
|
done
|
||||||
|
|
||||||
|
running=0
|
||||||
|
if [[ "${c}" == "10" ]]; then
|
||||||
|
if [[ $(echo ${p} | grep "^[0-9]*$") ]]; then
|
||||||
|
kill -9 ${p}
|
||||||
|
elif [[ $(echo ${p} | grep "^[0-9]* [0-9]*$") ]]; then
|
||||||
|
running=1
|
||||||
|
logger "pidof ${SM} still running."
|
||||||
|
RETVAL=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${running}" == "0" ]]; then
|
||||||
start-stop-daemon --start -b -x ${SM} -- ${sm_args}
|
start-stop-daemon --start -b -x ${SM} -- ${sm_args}
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${RETVAL} -eq 0 ]
|
if [ ${RETVAL} -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
else
|
else
|
||||||
echo "FAIL"
|
echo "FAIL ${RETVAL}"
|
||||||
RETVAL=1
|
RETVAL=1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -10,7 +10,7 @@ script = /etc/init.d/sm
|
||||||
style = lsb ; lsb
|
style = lsb ; lsb
|
||||||
severity = critical ; minor, major, critical
|
severity = critical ; minor, major, critical
|
||||||
restarts = 3 ; restarts before error assertion
|
restarts = 3 ; restarts before error assertion
|
||||||
startuptime = 15 ; seconds to wait after process start
|
startuptime = 5 ; seconds to wait after process start
|
||||||
interval = 5 ; number of seconds to wait between restarts
|
interval = 5 ; number of seconds to wait between restarts
|
||||||
debounce = 20 ; number of seconds to wait before degrade clear
|
debounce = 20 ; number of seconds to wait before degrade clear
|
||||||
quorum = 1 ; process is in the host watchdog quorum
|
quorum = 1 ; process is in the host watchdog quorum
|
||||||
|
|
Loading…
Reference in New Issue