added timeout to init script

This commit is contained in:
Martin Stransky 2006-10-05 13:06:25 +00:00
parent 66f11969cf
commit 2e702b326b
2 changed files with 24 additions and 9 deletions

View File

@ -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

View File

@ -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`;
@ -193,18 +196,27 @@ stop() {
echo -n $"Stopping $named: "
/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