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
|
|
|
[ -x $DAEMON ] || exit 0
|
|
|
|
[ -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
|
|
|
|
echo -n "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
|
2014-06-10 12:18:25 +02:00
|
|
|
echo -n "Starting domain name daemon: "
|
|
|
|
start-stop-daemon -S -x $DAEMON -- -c $CONFIG -u named
|
|
|
|
[ $? == 0 ] && echo "OK" || echo "FAIL"
|
2006-01-25 21:56:55 +01:00
|
|
|
;;
|
|
|
|
stop)
|
2014-06-10 12:18:25 +02:00
|
|
|
echo -n "Stopping domain name daemon: "
|
2006-01-25 21:56:55 +01:00
|
|
|
rndc stop || start-stop-daemon -K -x $DAEMON
|
2014-06-10 12:18:25 +02: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
|