autofs-5.0.6 - make autofs wait longer for shutdown

From: Ian Kent <ikent@redhat.com>

After signaling the automount daemon to shutdown the autofs init script
doesn't wait long enough for the daemon to exit. This can be a problem
if there are a large number of mounts or if servers are slow to respond.
---

 CHANGELOG                 |    1 +
 redhat/autofs.init.in     |    5 ++++-
 samples/autofs.service.in |    1 +
 samples/rc.autofs.in      |    5 ++++-
 4 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 182bc79..a914e8a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -54,6 +54,7 @@
 - fix libtirpc name clash.
 - check if /etc/mtab is a link to /proc/self/mounts.
 - fix nfs4 contacts portmap.
+- make autofs wait longer for shutdown completion.
 
 28/06/2011 autofs-5.0.6
 -----------------------
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index 0f4a16a..8e355da 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -108,7 +108,7 @@ function stop() {
 	while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do
 		killproc $prog -TERM >& /dev/null
 		RETVAL=$?
-		[ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3
+		[ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 20
 		count=`expr $count + 1`
 	done
 	if [ $RETVAL -eq 0 ]; then
@@ -129,6 +129,9 @@ function restart() {
 	status autofs > /dev/null 2>&1
 	if [ $? -eq 0 ]; then
 		stop
+		while [ -n "`pidof $prog`" ] ; do
+			sleep 5
+		done
 	fi
 	start
 }
diff --git a/samples/autofs.service.in b/samples/autofs.service.in
index 879b47b..277425b 100644
--- a/samples/autofs.service.in
+++ b/samples/autofs.service.in
@@ -8,6 +8,7 @@ PIDFile=@@autofspiddir@@/autofs.pid
 EnvironmentFile=-@@autofsconfdir@@/autofs
 ExecStart=@@sbindir@@/automount ${OPTIONS} --pid-file @@autofspiddir@@/autofs.pid
 ExecReload=/usr/bin/kill -HUP $MAINPID
+TimeoutSec=180
 
 [Install]
 WantedBy=multi-user.target
diff --git a/samples/rc.autofs.in b/samples/rc.autofs.in
index 35667ba..487669f 100644
--- a/samples/rc.autofs.in
+++ b/samples/rc.autofs.in
@@ -91,7 +91,7 @@ function stop() {
 	while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do
 		killall -TERM $prog >& /dev/null
 		RETVAL=$?
-		[ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3
+		[ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 20
 		count=`expr $count + 1`
 	done
 	if [ -z "`pidof $prog`" ] ; then
@@ -104,6 +104,9 @@ function stop() {
 
 function restart() {
 	stop
+	while [ -n "`pidof $prog`" ] ; do
+		sleep 5
+	done
 	start
 }