metaproxy.init: wait for MP to stop on SIGUSR1
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 4 Jul 2012 12:03:12 +0000 (12:03 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 4 Jul 2012 12:03:12 +0000 (12:03 +0000)
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.

rpm/metaproxy.init

index 4e11c37..cf32a35 100755 (executable)
@@ -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