adjust defconfig
[buildroot.git] / package / bind / bind.sysvinit
blob171d3208aafcf2252bf0b4a2a3cdbdf161c20bde
1 #!/bin/sh
3 # System-V init to control the bind DNS Daemon
6 NAME=named
7 DAEMON=/usr/sbin/$NAME
9 # this file contains a few tunable parameters
10 test -r /etc/default/named && . /etc/default/named
12 test -f $DAEMON || exit 0
14 set -e
16 case "$1" in
17 start)
18 test -z "$CHROOT" || ARGS="$ARGS -t $CHROOT"
19 test -z "$SETUID" || ARGS="$ARGS -u $SETUID"
20 if [ ! -f $CHROOT/etc/rndc.key ]; then
21 echo "Initializing $NAME control key: rndc-confgen"
22 set +e
24 # if rndc.key is a symlink, the target must exist
25 touch $CHROOT/etc/rndc.key
26 touch etc/rndc.key
28 rndc-confgen -a -r /dev/urandom $ARGS || true
29 set -e
31 test -z "$CONF" || ARGS="$ARGS -c $CONF"
32 echo -n "Starting domain name daemon: $NAME"
33 trap 'echo failed' 0
34 start-stop-daemon -S -x $DAEMON -- $ARGS
35 trap - 0
36 echo "."
38 stop)
39 echo -n "Stopping domain name daemon: $NAME"
40 rndc stop || start-stop-daemon -K -x $DAEMON
41 echo "."
43 restart)
44 $0 stop || true
45 sleep 2
46 $0 start
48 reload|force-reload)
49 rndc reload || $0 restart
52 echo "Usage: $0 {start|stop|restart|reload|force-reload}"
53 exit 1
54 esac
56 exit 0