handle named_sdb properly; checkconfig() must handle named "-c" option;
make configtest, test, check configcheck synonyms
This commit is contained in:
parent
70e5bc5879
commit
e9f83dfd42
53
named.init
53
named.init
@ -14,15 +14,19 @@
|
|||||||
# Source networking configuration.
|
# Source networking configuration.
|
||||||
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
|
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
|
||||||
|
|
||||||
RETVAL=0
|
|
||||||
prog="named"
|
|
||||||
|
|
||||||
# Check that networking is up.
|
# Check that networking is up.
|
||||||
[ "${NETWORKING}" = "no" ] && exit 1
|
[ "${NETWORKING}" = "no" ] && exit 1
|
||||||
|
|
||||||
[ -r /etc/sysconfig/named ] && . /etc/sysconfig/named
|
[ -r /etc/sysconfig/named ] && . /etc/sysconfig/named
|
||||||
|
|
||||||
[ -x /usr/sbin/named ] || exit 1
|
RETVAL=0
|
||||||
|
named='named'
|
||||||
|
if [[ "$ENABLE_SDB" = [yY1]* ]] && [ -x /usr/sbin/named_sdb ]; then
|
||||||
|
named='named_sdb';
|
||||||
|
fi;
|
||||||
|
prog=$named
|
||||||
|
|
||||||
|
[ -x /usr/sbin/$named ] || exit 1
|
||||||
|
|
||||||
[ -r ${ROOTDIR}/etc/named.conf ] || exit 1
|
[ -r ${ROOTDIR}/etc/named.conf ] || exit 1
|
||||||
|
|
||||||
@ -30,9 +34,9 @@ prog="named"
|
|||||||
|
|
||||||
start() {
|
start() {
|
||||||
# Start daemons.
|
# Start daemons.
|
||||||
echo -n $"Starting $prog: "
|
echo -n $"Starting $named: "
|
||||||
if [ -n "`/sbin/pidof named`" ]; then
|
if [ -n "`/sbin/pidof -o %PPID $named`" ]; then
|
||||||
echo -n $"$prog: already running"
|
echo -n $"$named: already running"
|
||||||
failure
|
failure
|
||||||
echo
|
echo
|
||||||
return 1
|
return 1
|
||||||
@ -51,6 +55,10 @@ start() {
|
|||||||
mount -tproc none ${ROOTDIR}/proc >/dev/null 2>&1
|
mount -tproc none ${ROOTDIR}/proc >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [[ "${OPTIONS}" = *-c* ]]; then
|
||||||
|
cf=`echo ${OPTIONS} | sed 's/^.*-c[\ \ ]//;s/[\ \ ].*$//'`;
|
||||||
|
ckcf_options="$ckcf_options $cf";
|
||||||
|
fi;
|
||||||
no_write_master_zones=0
|
no_write_master_zones=0
|
||||||
if [ -e /etc/selinux/config ]; then
|
if [ -e /etc/selinux/config ]; then
|
||||||
. /etc/selinux/config
|
. /etc/selinux/config
|
||||||
@ -86,16 +94,16 @@ start() {
|
|||||||
else
|
else
|
||||||
RETVAL=$?;
|
RETVAL=$?;
|
||||||
fi
|
fi
|
||||||
PROG=named
|
|
||||||
if [[ "$ENABLE_SDB" = [yY1]* ]] && [ -x /usr/sbin/named_sdb ]; then
|
|
||||||
PROG=named_sdb;
|
|
||||||
fi;
|
|
||||||
if [ $conf_ok -eq 1 ]; then
|
if [ $conf_ok -eq 1 ]; then
|
||||||
daemon /usr/sbin/$PROG -u named ${OPTIONS};
|
daemon /usr/sbin/$named -u named ${OPTIONS};
|
||||||
RETVAL=$?;
|
RETVAL=$?;
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
rm -f /var/run/named.pid
|
rm -f /var/run/named.pid
|
||||||
|
rm -f /var/run/named_sdb.pid 2>/dev/null
|
||||||
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid;
|
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid;
|
||||||
|
if [ "$named" = "named_sdb" ]; then
|
||||||
|
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named_sdb.pid;
|
||||||
|
fi;
|
||||||
fi;
|
fi;
|
||||||
else
|
else
|
||||||
named_err="`/usr/sbin/named-checkconf $ckcf_options 2>&1`";
|
named_err="`/usr/sbin/named-checkconf $ckcf_options 2>&1`";
|
||||||
@ -115,18 +123,20 @@ start() {
|
|||||||
}
|
}
|
||||||
stop() {
|
stop() {
|
||||||
# Stop daemons.
|
# Stop daemons.
|
||||||
echo -n $"Stopping $prog: "
|
echo -n $"Stopping $named: "
|
||||||
/usr/sbin/rndc stop >/dev/null 2>&1
|
/usr/sbin/rndc stop >/dev/null 2>&1
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
rm -f /var/lock/subsys/named
|
rm -f /var/lock/subsys/named
|
||||||
rm -f /var/run/named.pid
|
rm -f /var/run/named.pid
|
||||||
elif pidof named >/dev/null; then
|
rm -f /var/run/named_sdb.pid 2>/dev/null
|
||||||
killproc named -TERM >/dev/null 2>&1
|
elif /sbin/pidof -o %PPID $named >/dev/null; then
|
||||||
|
killproc $named -TERM >/dev/null 2>&1
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
rm -f /var/lock/subsys/named
|
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
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
@ -137,7 +147,6 @@ stop() {
|
|||||||
echo
|
echo
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
rhstatus() {
|
rhstatus() {
|
||||||
/usr/sbin/rndc status
|
/usr/sbin/rndc status
|
||||||
return $?
|
return $?
|
||||||
@ -149,14 +158,14 @@ restart() {
|
|||||||
start
|
start
|
||||||
}
|
}
|
||||||
reload() {
|
reload() {
|
||||||
echo -n $"Reloading $prog: "
|
echo -n $"Reloading $named: "
|
||||||
p=`/sbin/pidof -o %PPID named`
|
p=`/sbin/pidof -o %PPID $named`
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ "$RETVAL" -eq 0 ]; then
|
if [ "$RETVAL" -eq 0 ]; then
|
||||||
/usr/sbin/rndc reload >/dev/null 2>&1 || /bin/kill -HUP $p;
|
/usr/sbin/rndc reload >/dev/null 2>&1 || /bin/kill -HUP $p;
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
fi
|
fi
|
||||||
[ "$RETVAL" -eq 0 ] && success $"$prog reload" || failure $"$prog reload"
|
[ "$RETVAL" -eq 0 ] && success $"$named reload" || failure $"$named reload"
|
||||||
echo
|
echo
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
@ -172,6 +181,10 @@ checkconfig() {
|
|||||||
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
|
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
|
||||||
ckcf_options="$ckcf_options -t ${ROOTDIR}";
|
ckcf_options="$ckcf_options -t ${ROOTDIR}";
|
||||||
fi;
|
fi;
|
||||||
|
if [[ "${OPTIONS}" = *-c* ]]; then
|
||||||
|
cf=`echo ${OPTIONS} | sed 's/^.*-c[\ \ ]//;s/[\ \ ].*$//'`;
|
||||||
|
ckcf_options="$ckcf_options $cf";
|
||||||
|
fi;
|
||||||
if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ; then
|
if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ; then
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
@ -202,7 +215,7 @@ case "$1" in
|
|||||||
probe)
|
probe)
|
||||||
probe
|
probe
|
||||||
;;
|
;;
|
||||||
checkconfig)
|
checkconfig|configtest|check|test)
|
||||||
checkconfig
|
checkconfig
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
Loading…
Reference in New Issue
Block a user