summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stransky <stransky@fedoraproject.org>2006-10-05 13:06:25 +0000
committerMartin Stransky <stransky@fedoraproject.org>2006-10-05 13:06:25 +0000
commit184e136c42f204d78975ab94af27f65626e481d4 (patch)
tree554b453604bed6bdd676546533f05962a2c44274
parentf0295fac62ba6d346cb49a3f4758e0fd857a9448 (diff)
added timeout to init script
-rw-r--r--bind.spec5
-rwxr-xr-xnamed.init30
2 files changed, 25 insertions, 10 deletions
diff --git a/bind.spec b/bind.spec
index 5a5426c..7b9b426 100644
--- a/bind.spec
+++ b/bind.spec
@@ -454,7 +454,7 @@ for f in my.internal.zone.db slaves/my.slave.internal.zone.db slaves/my.ddns.int
echo '@ in soa localhost. root 1 3H 15M 1W 1D
ns localhost.' > sample/var/named/$f;
done
-/usr/bin/tail -n '+'`/bin/egrep -n '\\$Id: bind.spec,v 1.132 2006/10/05 11:14:27 stransky Exp $/+1/' | bc` bin/rndc/rndc.conf | sed '/Sample rndc configuration file./{p;i\
+/usr/bin/tail -n '+'`/bin/egrep -n '\\$Id: bind.spec,v 1.133 2006/10/05 13:06:25 stransky Exp $/+1/' | bc` bin/rndc/rndc.conf | sed '/Sample rndc configuration file./{p;i\
*\
* NOTE: you only need to create this file if it is to\
* differ from the following default contents:
@@ -785,6 +785,9 @@ rm -rf ${RPM_BUILD_ROOT}
* Thu Oct 5 2006 Martin Stransky <stransky@redhat.com> - 30:9.3.3-3
- added fix from #209400 - Bind Init Script does not create
the PID file always, created by Jeff Means
+- added timeout to stop section of init script.
+ The default is 100 sec. and can be adjusted by NAMED_SHUTDOWN_TIMEOUT
+ shell variable.
* Mon Oct 2 2006 Martin Stransky <stransky@redhat.com> - 30:9.3.3-2
- removed chcon from post script, replaced by restorecon
diff --git a/named.init b/named.init
index d5aa418..0088c72 100755
--- a/named.init
+++ b/named.init
@@ -19,6 +19,9 @@
[ -r /etc/sysconfig/named ] && . /etc/sysconfig/named
+# Don't kill named dunring clean-up
+NAMED_SHUTDOWN_TIMEOUT=${NAMED_SHUTDOWN_TIMEOUT:-100}
+
if [ -n "$ROOTDIR" ]; then
ROOTDIR=`echo $ROOTDIR | sed 's#//*#/#g;s#/$##'`;
rdl=`/usr/bin/readlink $ROOTDIR`;
@@ -194,17 +197,26 @@ stop() {
/usr/sbin/rndc stop >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
+ timeout=0
+ while : ; do
+ if /sbin/pidof -o %PPID $named >/dev/null; then
+ if [ $timeout -ge $NAMED_SHUTDOWN_TIMEOUT ]; then
+ killproc $named -TERM >/dev/null 2>&1
+ RETVAL=$?
+ break
+ else
+ sleep 2 && echo -n "."
+ timeout=$((timeout+2))
+ fi;
+ else
+ break
+ fi;
+ done
+ fi;
+ if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/named
- rm -f /var/run/named.pid
+ rm -f /var/run/named.pid
rm -f /var/run/named_sdb.pid 2>/dev/null
- elif /sbin/pidof -o %PPID $named >/dev/null; then
- killproc $named -TERM >/dev/null 2>&1
- RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- rm -f /var/lock/subsys/named
- rm -f /var/run/named.pid
- rm -f /var/run/named_sdb.pid 2>/dev/null
- fi;
fi;
if [ $RETVAL -eq 0 ]; then
success