add notification for existing pidfile

The zuul.init and zuul-merger.init puppet module files did not check if
pidfiles existed when starting both services. The pidfile's might exist
in the event that the zuul-server and merger were killed, which doesn't
clean them up. This change checks for whether those files exist and notifies
the user to run the stop command which will clean up any residual pid files.

Change-Id: Ie65fdf372f1710ab0c32d03f6b359e1860f566db
This commit is contained in:
Arkadiy Kraminsky 2015-06-22 16:36:06 -07:00
parent 81c73e23a2
commit b03adc90a8
2 changed files with 10 additions and 0 deletions

View File

@ -42,10 +42,14 @@ do_start()
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
# 3 if pid file already exist
mkdir -p /var/run/$NAME
chown $USER /var/run/$NAME
ulimit -n 8192
if [ -f $PIDFILE ]; then
return 3
fi
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON -- \
@ -93,6 +97,7 @@ case "$1" in
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
3) echo "Pidfile at $PIDFILE already exists, run service zuul-merger stop to clean up."
esac
;;
stop)

View File

@ -42,10 +42,14 @@ do_start()
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
# 3 if pid file exits already
mkdir -p /var/run/$NAME
chown $USER /var/run/$NAME
ulimit -n 8192
if [ -f $PIDFILE ]; then
return 3
fi
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON -- \
@ -118,6 +122,7 @@ case "$1" in
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
3) echo "Pidfile at $PIDFILE already exists, run service zuul stop to clean up." ;;
esac
;;
stop)