0013c2a416
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@2827 6952d904-891a-0410-993b-d76249ca496b
78 lines
1.8 KiB
Plaintext
Executable File
78 lines
1.8 KiB
Plaintext
Executable File
#!/sbin/runscript
|
|
# Copyright 1999-2010 Gentoo Foundation
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r5,v 1.3 2010/09/03 17:52:01 idl0r Exp $
|
|
|
|
opts="start stop reload restart"
|
|
|
|
depend() {
|
|
need net
|
|
use logger
|
|
provide dns
|
|
}
|
|
|
|
checkconfig() {
|
|
if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
|
|
eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
|
|
fi
|
|
|
|
# In case someone doesn't have $CPU set from /etc/conf.d/named
|
|
if [ ! ${CPU} ] ; then
|
|
CPU="1"
|
|
fi
|
|
|
|
# as suggested in bug #107724
|
|
[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
|
|
egrep -v \
|
|
"^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \
|
|
${CHROOT}/etc/bind/named.conf \
|
|
| egrep -o -m1 "pid\-file +\".+\" *;" \
|
|
| cut -d\" -f2
|
|
)
|
|
|
|
KEY="${CHROOT}/etc/bind/rndc.key"
|
|
|
|
# create piddir (usually /var/run/named) if necessary
|
|
local piddir="${PIDFILE%/*}"
|
|
if [ ! -d "${piddir}" ] ; then
|
|
checkpath -q -d -o root:named -m 0770 "${piddir}" || return 1
|
|
fi
|
|
}
|
|
|
|
start() {
|
|
ebegin "Starting ${CHROOT:+chrooted }named"
|
|
checkconfig || return 1
|
|
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
|
|
--nicelevel ${NAMED_NICELEVEL:-0} \
|
|
--exec /usr/sbin/named \
|
|
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
|
|
eend $?
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping ${CHROOT:+chrooted }named"
|
|
checkconfig || return 2
|
|
if [ -f $KEY ] ; then
|
|
rndc -k $KEY stop &>/dev/null
|
|
else
|
|
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
|
|
--exec /usr/sbin/named
|
|
fi
|
|
eend $?
|
|
}
|
|
|
|
reload() {
|
|
checkconfig || return 3
|
|
if [ ! -f $PIDFILE ] ; then
|
|
/etc/init.d/named start &>/dev/null
|
|
exit
|
|
fi
|
|
|
|
if [ -f $KEY ] ; then
|
|
ebegin "Reloading named.conf and zone files"
|
|
rndc -k $KEY reload &>/dev/null
|
|
eend $?
|
|
else /etc/init.d/named restart &>/dev/null
|
|
fi
|
|
}
|