[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [SRM] Bug #554793



On Thu, Jan 14, 2010 at 05:44:12PM +0000, Tim Small wrote:
> Just to add some background to this...  The watchdog module is
> typically deployed on systems which require a high uptime.
> ...

To make the decision easier here's also the main part of the patch to be
applied. Note that I just copied and pasted it and not test it at all, so it
might still be buggy, but you get the idea.

Yes, there is only one file to be changed.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo/Skype: michaelmeskes, Jabber: meskes@jabber.org
VfL Borussia! Forca Barca! Go SF 49ers! Use: Debian GNU/Linux, PostgreSQL
--- watchdog-5.4/debian/init	2010-01-15 14:24:03.000000000 +0100
+++ init	2010-01-15 14:56:00.000000000 +0100
@@ -29,16 +29,29 @@
 [ -e /etc/default/watchdog ] && . /etc/default/watchdog
 
 NAME=watchdog
+KEEPALIVE_NAME=wd_keepalive
+
 DAEMON=/usr/sbin/watchdog
+KEEPALIVE_DAEMON=/usr/sbin/wd_keepalive
+
+STOP_RETRY_SCHEDULE='TERM/10/forever/KILL/1'
 
 case "$1" in
   start)
     if [ $run_watchdog = 1 ]
     then
     	# do we have to load a module?
-	[ $watchdog_module != "none" ] && /sbin/modprobe $watchdog_module
-	# make sure that wd_keepalive is stopped if available
-	[ -e /etc/init.d/wd_keepalive ] && /etc/init.d/wd_keepalive stop
+	[ ${watchdog_module:-none} != "none" ] && /sbin/modprobe $watchdog_module
+	# make sure that wd_keepalive is stopped
+	echo -n "Stopping watchdog keepalive daemon: "
+        if start-stop-daemon --stop --quiet -oknodo --retry $STOP_RETRY_SCHEDULE \
+            --pidfile  /var/run/$KEEPALIVE_NAME.pid
+	then
+		echo wd_keepalive.
+	else
+		echo
+	fi
+
 	echo -n "Starting watchdog daemon: "
 	if start-stop-daemon --start --quiet \
 	    --exec $DAEMON -- $watchdog_options
@@ -54,12 +67,19 @@
     if [ $run_watchdog = 1 ]
     then
 	echo -n "Stopping watchdog daemon: "
-	if start-stop-daemon --stop --quiet \
+	if start-stop-daemon --stop --quiet --retry $STOP_RETRY_SCHEDULE \
 	    --pidfile /var/run/$NAME.pid
 	then
 	    echo watchdog.
-	    # make sure that wd_keepalive is started if available
-	    [ -e /etc/init.d/wd_keepalive ] && /etc/init.d/wd_keepalive start
+	    # make sure that wd_keepalive is started
+	    echo -n "Stopping watchdog keepalive daemon: "
+	    if start-stop-daemon --start --quiet \
+	        --exec $KEEPALIVE_DAEMON -- $watchdog_options
+	    then
+		echo wd_keepalive.
+	    else
+		echo
+	    fi
 	else
 	    echo
 	fi
@@ -73,9 +93,8 @@
   force-reload)
     if [ $run_watchdog = 0 ]; then exit 0; fi
     echo -n "Restarting $NAME daemon."
-    start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid
-    echo -n "."
-    sleep 5
+    start-stop-daemon --stop --pidfile /var/run/$NAME.pid --quiet \
+	--retry $STOP_RETRY_SCHEDULE
     echo -n "."
     if start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
 	--exec $DAEMON -- $watchdog_options

Reply to: