Blame SOURCES/autofs-5.0.7-dont-wait-forever-to-restart.patch

306fa1
autofs-5.0.7 - dont wait forever to restart
306fa1
306fa1
From: Ian Kent <ikent@redhat.com>
306fa1
306fa1
When restarting autofs the daemon must be stopped before it is started
306fa1
again if it is to function properly. At the moment the init script waits
306fa1
forever which is not ok if the daemon won't exit for some reason.
306fa1
306fa1
So, if the daemon is still running after the stop, run stop() again, wait
306fa1
a bit longer and if it still hasn't stopped kill it with a SIGKILL to clear
306fa1
the way for the startup.
306fa1
---
306fa1
306fa1
 CHANGELOG             |    1 +
306fa1
 redhat/autofs.init.in |   13 ++++++++++---
306fa1
 2 files changed, 11 insertions(+), 3 deletions(-)
306fa1
306fa1
306fa1
diff --git a/CHANGELOG b/CHANGELOG
306fa1
index 6051723..93b9c26 100644
306fa1
--- a/CHANGELOG
306fa1
+++ b/CHANGELOG
306fa1
@@ -5,6 +5,7 @@
306fa1
 - fix ipv6 proximity calculation.
306fa1
 - fix parse buffer initialization.
306fa1
 - fix typo in automount(8).
306fa1
+- dont wait forever to restart.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
306fa1
index ec6d5d6..cd5cb34 100644
306fa1
--- a/redhat/autofs.init.in
306fa1
+++ b/redhat/autofs.init.in
306fa1
@@ -129,9 +129,16 @@ function restart() {
306fa1
 	status autofs > /dev/null 2>&1
306fa1
 	if [ $? -eq 0 ]; then
306fa1
 		stop
306fa1
-		while [ -n "`pidof $prog`" ] ; do
306fa1
-			sleep 5
306fa1
-		done
306fa1
+		if [ -n "`pidof $prog`" ]; then
306fa1
+			# If we failed to stop, try at least one more time
306fa1
+			# after waiting a little while
306fa1
+			sleep 20
306fa1
+			stop
306fa1
+			auto_pid=`pidof $prog`
306fa1
+			if [ -n "$auto_pid" ]; then
306fa1
+				kill -9 $auto_pid
306fa1
+			fi
306fa1
+		fi
306fa1
 	fi
306fa1
 	start
306fa1
 }