From c6059ce5d6d129af6a3eccfcd6ca4a111cff60ea Mon Sep 17 00:00:00 2001 From: unicell Date: Sat, 29 Sep 2012 13:50:09 +0800 Subject: [PATCH] Fix restart logic in zuul init script Change-Id: I4ddd69916db4d9df036d3d674fb58847981d2758 Reviewed-on: https://review.openstack.org/13810 Reviewed-by: Clark Boylan Reviewed-by: Antoine Musso Approved: James E. Blair Reviewed-by: James E. Blair Tested-by: Jenkins --- modules/zuul/files/zuul.init | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/zuul/files/zuul.init b/modules/zuul/files/zuul.init index 1572d05b9c..80fa2f181b 100755 --- a/modules/zuul/files/zuul.init +++ b/modules/zuul/files/zuul.init @@ -78,19 +78,23 @@ do_stop() do_graceful_stop() { PID=`cat $PIDFILE` - kill -10 $PID + kill -USR1 $PID - # wait until really stopped - if [ -n "${PID:-}" ]; then - while kill -0 "${PID:-}" 2> /dev/null; do - if [ $i = '0' ]; then - echo -n " ... waiting " - else - echo -n "." - fi - sleep 1 - done - fi + # wait until really stopped + if [ -n "${PID:-}" ]; then + i=0 + while kill -0 "${PID:-}" 2> /dev/null; do + if [ $i -eq '0' ]; then + echo -n " ... waiting " + else + echo -n "." + fi + i=$(($i+1)) + sleep 1 + done + fi + + rm -f /var/run/$NAME/* } #