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

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