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

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