Hello,
I read the code involved for stopping flumotion and basically it is a
matter of retrieving the pid's from the /var/run/flumotion/*.pid files
and terminating/waiting/killing the processes. I propose a fix that does
it without calling the python code. Hope this will be usefull.
Cheers.
--
Giovanni
--- flumotion.rtupdate_old 2010-04-16 23:29:25.000000000 +0200
+++ flumotion.rtupdate 2010-04-16 23:59:15.000000000 +0200
@@ -6,6 +6,9 @@
DESC="Flumotion Streaming Server"
NAME="flumotion"
SCRIPTNAME="/etc/init.d/$NAME"
+TERMWAIT=20
+KILLWAIT=10
+RUNDIR="/var/run"
# Read configuration variable file if it is present
[ -r "/etc/default/$NAME" ] && . "/etc/default/$NAME"
@@ -29,13 +32,22 @@
case "$action" in
pre-rtupdate)
[ "$VERBOSE" != no ] && log_warning_msg "Stopping $DESC during Python runtime change..."
- if [ -x "$SCRIPTNAME" ]; then
- if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
- invoke-rc.d "$NAME" stop
- else
- "$SCRIPTNAME" stop
- fi
- fi
+ for pidfile in $RUNDIR/$NAME/*.pid; do
+ [ "$pidfile" = "$RUNDIR/$NAME/*.pid" ] && exit 0
+ pid=`head -n 1 "$pidfile"`
+ counter=0
+ while (kill -0 $pid 1>/dev/null 2>&1); do
+ [ $counter -eq 0 ] && kill -TERM $pid
+ [ $counter -eq $TERMWAIT ] && kill -KILL $pid
+ if [ $counter -eq $(($TERMWAIT+$KILLWAIT)) ]; then
+ #FIXME: not sure about what to do here
+ log_failure_msg "Could not kill process with pid $pid"
+ exit 1
+ fi
+ counter=$(($counter+1))
+ sleep 1
+ done
+ done
;;
post-rtupdate)
[ "$VERBOSE" != no ] && log_warning_msg "Restarting $DESC after Python runtime change..."