can not stop named
Jason Vas Dias
jvdias at redhat.com
Mon Oct 10 13:42:26 UTC 2005
On Monday 10 October 2005 06:44, hamideh d wrote:
> hi,
> the named service on my box doesn't get stopped.
> service named stop command doesn't answer,
> i can just reload the named service,
> what can i do ?
> my box is redhat9 . and the bind9.2.1-16.
>
> tnx friends .
>
Hi -
It sounds like you may have an rndc configuration problem -
earlier versions of the named.init script could not stop
named without rndc . Try running 'rndc-confgen' and ensuring
that your /etc/rndc.key file is included in both named.conf
and /etc/rndc.conf.
Below is the current named initscript version used for RHEL-3,
which is similar to the version for FC-3 sent in previous post on
$subject, but without the SDB and SELinux stuff.
NOTE: you are recommended to at least upgrade to a later
BIND version, if not a later OS (eg. FC-4) .
You can try installing the BIND-9.3.1 binary RPMs I built for
RHEL-2.1, which may work on RHL-9.0:
http://people.redhat.com/~jvdias/bind/RHEL-2.1
or building the bind-9.3.1-1_EL2-src.rpm with 'rpmbuild --rebuild'.
Let me know if you've any further problems -
Regards,
Jason Vas Dias
Red Hat BIND package maintainer
--- /etc/init.d/named
#!/bin/bash
#
# named This shell script takes care of starting and stopping
# named (BIND DNS server).
#
# chkconfig: - 55 45
# description: named (BIND) is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# probe: true
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
RETVAL=0
prog="named"
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 1
[ -r /etc/sysconfig/named ] && . /etc/sysconfig/named
[ -x /usr/sbin/named ] || exit 1
named_conf=${ROOTDIR}/etc/named.conf
c_opt=0
if [[ "${OPTIONS}" = *-c* ]]; then
named_conf=`echo ${OPTIONS} | sed 's/^.*-c[\ \ ]//;s/[\ \ ].*$//'`;
c_opt=1;
fi;
[ -r ${named_conf} ] || exit 1
if [ ${c_opt} -eq 0 ]; then
named_conf='';
fi;
[ -n "$ROOTDIR" ] && ROOTDIR=`echo $ROOTDIR | sed 's#//*#/#g;s#/$##'`
start() {
# Start daemons.
echo -n $"Starting $prog: "
if [ -n "`/sbin/pidof named`" ]; then
echo -n $"$prog: already running"
failure
echo
return 1
fi
ckcf_options='';
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
ckcf_options="-t ${ROOTDIR}";
if [ -s /etc/localtime ]; then
cp -fp /etc/localtime ${ROOTDIR}/etc/localtime
fi;
if [ ! -d ${ROOTDIR}/proc ]; then
mkdir -p ${ROOTDIR}/proc
fi
if ! egrep -q "${ROOTDIR}/proc proc" /etc/mtab; then
mount -tproc none ${ROOTDIR}/proc >/dev/null 2>&1
fi
fi
conf_ok=0;
if [ -x /usr/sbin/named-checkconf ] && /usr/sbin/named-checkconf $ckcf_options $named_conf >/dev/null 2>&1; then
conf_ok=1;
else
RETVAL=$?;
fi
if [ $conf_ok -eq 1 ]; then
daemon /usr/sbin/named -u named ${OPTIONS};
RETVAL=$?;
if [ $RETVAL -eq 0 ]; then
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid;
fi;
else
named_err="`/usr/sbin/named-checkconf $ckcf_options ${named_conf} 2>&1`";
echo
echo $"Error in named configuration"':';
echo "$named_err";
failure
echo
if [ -x /usr/bin/logger ]; then
echo "$named_err" | /usr/bin/logger -pdaemon.error -tnamed
fi;
return $RETVAL;
fi;
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/named
echo
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Stopping $prog: "
/usr/sbin/rndc stop >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/named
rm -f /var/run/named.pid
elif pidof 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
fi;
fi;
if [ $RETVAL -eq 0 ]; then
success
else
failure
fi;
echo
return $RETVAL
}
rhstatus() {
/usr/sbin/rndc status
return $?
}
restart() {
stop
# wait a couple of seconds for the named to finish closing down
sleep 2
start
}
reload() {
echo -n $"Reloading $prog: "
p=`/sbin/pidof -o %PPID named`
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
/usr/sbin/rndc reload >/dev/null 2>&1 || /bin/kill -HUP $p;
RETVAL=$?
fi
[ "$RETVAL" -eq 0 ] && success $"$prog reload" || failure $"$prog reload"
echo
return $?
}
probe() {
# named knows how to reload intelligently; we don't want linuxconf
# to offer to restart every time
/usr/sbin/rndc reload >/dev/null 2>&1 || echo start
return $?
}
checkconfig() {
ckcf_options=''
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
ckcf_options="$ckcf_options -t ${ROOTDIR}";
fi;
if [ -x /usr/sbin/named-checkconf ] && /usr/sbin/named-checkconf $ckcf_options ${named_conf}; then
return 0;
else
return 1;
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rhstatus
;;
restart)
restart
;;
condrestart)
if [ -e /var/lock/subsys/named ]; then restart; fi
;;
reload)
reload
;;
probe)
probe
;;
checkconfig|configtest|check|test)
checkconfig
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|probe}"
exit 1
esac
exit $?
---
More information about the bind-users
mailing list