Make zuul restart graceful.

Add /var/lib/zuul so it can save the queue there.

Change-Id: I4ebb18f0502735ad18191a0dc5ddc26f6ef32e05
This commit is contained in:
James E. Blair 2012-07-06 10:39:06 -07:00
parent fe777f993a
commit 6b2bd12070
2 changed files with 28 additions and 15 deletions

View File

@ -72,6 +72,27 @@ do_stop()
return "$RETVAL"
}
#
# Function that stops the daemon/service
#
do_graceful_stop()
{
PID=`cat $PIDFILE`
kill -10 $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
}
#
# Function that sends a SIGHUP to the daemon/service
#
@ -120,21 +141,8 @@ case "$1" in
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
do_graceful_stop
do_start
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2

View File

@ -47,6 +47,11 @@ class zuul ()
owner => 'jenkins'
}
file { "/var/lib/zuul":
ensure => "directory",
owner => 'jenkins'
}
file { "/etc/init.d/zuul/":
owner => 'root',
group => 'root',