2006-01-25 21:56:55 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2014-06-10 12:18:25 +02:00
|
|
|
CONFIG=/etc/bind/named.conf
|
|
|
|
DAEMON=/usr/sbin/named
|
2006-01-25 21:56:55 +01:00
|
|
|
|
2014-06-10 12:18:25 +02:00
|
|
|
[ -f $CONFIG ] || exit 0
|
2006-01-25 21:56:55 +01:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
2014-06-10 12:18:25 +02:00
|
|
|
if [ ! -f /etc/rndc.key ]; then
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Initializing bind control key: "
|
2006-04-14 21:25:54 +02:00
|
|
|
# if rndc.key is a symlink, the target must exist
|
2014-06-10 12:18:25 +02:00
|
|
|
touch /etc/rndc.key
|
|
|
|
rndc-confgen -a -r /dev/urandom 2>/dev/null && echo "OK" || echo "FAIL"
|
2006-01-25 21:56:55 +01:00
|
|
|
fi
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting domain name daemon: "
|
2014-06-10 12:18:25 +02:00
|
|
|
start-stop-daemon -S -x $DAEMON -- -c $CONFIG -u named
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2006-01-25 21:56:55 +01:00
|
|
|
;;
|
|
|
|
stop)
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Stopping domain name daemon: "
|
2006-01-25 21:56:55 +01:00
|
|
|
rndc stop || start-stop-daemon -K -x $DAEMON
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2006-01-25 21:56:55 +01:00
|
|
|
;;
|
|
|
|
restart)
|
2006-04-14 21:25:54 +02:00
|
|
|
$0 stop || true
|
2014-06-10 12:18:25 +02:00
|
|
|
sleep 1
|
2006-04-14 21:25:54 +02:00
|
|
|
$0 start
|
2006-01-25 21:56:55 +01:00
|
|
|
;;
|
|
|
|
reload|force-reload)
|
2006-04-14 21:25:54 +02:00
|
|
|
rndc reload || $0 restart
|
2006-01-25 21:56:55 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
|
2013-07-19 21:41:20 +02:00
|
|
|
exit 1
|
2006-01-25 21:56:55 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|