mythtv-backend: init restart unreliable [patch]

Top Page

Reply to this message
Author: Stephan Sürken
Date:  
To: Debian Multimedia Discussion
Subject: mythtv-backend: init restart unreliable [patch]
Hi Christian,

I noticed '/etc/init.d/mythtv-backend restart' is unreliable.

This is due to the 'sleep 3' solution between stop/start via
start-stop-daemon; this is not sufficient for my setup, so in most
cases, myth is just stopped on restart as the second start-stop call
still finds a valid pid.

start-stop's "-retry" should imho fix this quite elegantly, see
attachment.

Thanks!

Stephan

--- mythtv-backend.init.orig    2012-07-07 17:10:23.000000000 +0000
+++ mythtv-backend.init    2012-07-07 17:11:17.558562999 +0000
@@ -62,10 +62,9 @@
     ;;
   restart|force-reload)
     echo -n "Restarting $DESC: $NAME "
-    start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
+    start-stop-daemon --stop --oknodo --retry 10 --pidfile $RUNDIR/$NAME.pid \
                 --chuid $USER --exec $DAEMON -- $ARGS
     echo "."
-    sleep 3
     start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
                 --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
     echo "."