supervisor init script doesn't wait for supervisor to stop

Bug #1427434 reported by Justin Patrin
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
supervisor (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Since the supervisor doesn't block while stopping the init script returns from the stop command before the process dies. The following patch fixes this:

diff --git a/debian/supervisor.init b/debian/supervisor.init
index 334d4c6..49ed69b 100644
--- a/debian/supervisor.init
+++ b/debian/supervisor.init
@@ -100,10 +100,18 @@ case "$1" in
         fi
        ;;
   stop)
- echo -n "Stopping $DESC: "
- start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
- echo "$NAME."
- ;;
+ echo -n "Stopping $DESC: "
+ if [ -e $PIDFILE ]; then
+ pid=$(cat $PIDFILE)
+ fi
+ start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
+ if [ ! -z "$pid" ]; then
+ while [ -e /proc/$pid ]; do
+ sleep 1;
+ done
+ fi
+ echo "$NAME."
+ ;;
   force-stop)
        echo -n "Forcefully stopping $DESC: "
         force_stop

Justin Patrin (jpatrin)
description: updated
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in supervisor (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.