From: Adam Dickmeiss Date: Wed, 4 Jul 2012 12:03:12 +0000 (+0000) Subject: metaproxy.init: wait for MP to stop on SIGUSR1 X-Git-Tag: v1.3.38~3 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=a14a09b58d112f182db3243622323bd23666a659;p=metaproxy-moved-to-github.git metaproxy.init: wait for MP to stop on SIGUSR1 Unfortunately, killproc utility silently ignores option -d when a any user signal is given, so we have to wait ourselves for the process to terminate. --- diff --git a/rpm/metaproxy.init b/rpm/metaproxy.init index 4e11c37..cf32a35 100755 --- a/rpm/metaproxy.init +++ b/rpm/metaproxy.init @@ -132,10 +132,28 @@ reload() { $DAEMON $OPTIONS -t >/dev/null 2>&1 RETVAL=$? if [ $RETVAL = 0 ]; then - killproc -p ${pidfile} -d 10 $DAEMON -USR1 + killproc -p ${pidfile} $DAEMON -USR1 >/dev/null 2>&1 RETVAL=$? - rm -f ${pidfile} + if [ $RETVAL = 0 ]; then + i=0 + p=`cat ${pidfile}` + while [ -d /proc/$p -a $i -lt 100 ]; do + i=`expr $i + 1` + usleep 50000 + done + if [ -d /proc/$p ]; then + echo_failure + rc_status -v + RETVAL=1 + else + rm -f ${pidfile} + fi + else + echo_failure + rc_status -v + fi else + echo_failure rc_status -v echo $"not reloading due to configuration syntax error" fi