diff options
Diffstat (limited to 'net-dns/bind/files/named.rc7')
-rw-r--r-- | net-dns/bind/files/named.rc7 | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/net-dns/bind/files/named.rc7 b/net-dns/bind/files/named.rc7 new file mode 100644 index 000000000000..e2663994978a --- /dev/null +++ b/net-dns/bind/files/named.rc7 @@ -0,0 +1,66 @@ +#!/sbin/runscript +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.rc7,v 1.1 2003/04/27 22:37:46 lostlogic 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 + + if [ $CHROOT -a -d $CHROOT ] ; then + PIDFILE="${CHROOT}/var/run/named/named.pid" + KEY="${CHROOT}/etc/bind/rndc.key" + else + PIDFILE="/var/run/named/named.pid" + KEY="/etc/bind/rndc.key" + fi +} + +start() { + ebegin "Starting ${CHROOT:+chrooted }named" + checkconfig || return 1 + start-stop-daemon --start --quiet --exec /usr/sbin/named -- -u named -n $CPU $OPTIONS ${CHROOT:+-t $CHROOT} + eend $? +} + +stop() { + ebegin "Stopping named" + checkconfig || return 2 + start-stop-daemon --stop --quiet --pidfile $PIDFILE + 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 +} + +restart() { + svc_stop + svc_start +} + |