0f75b2635e
'echo -n' is not a POSIX construct (no flag support), we shoud use 'printf', especially in init script. This patch was generated by the following command line: git grep -l 'echo -n' -- `git ls-files | grep -v 'patch'` | xargs sed -i 's/echo -n/printf/' Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
40 lines
875 B
Bash
40 lines
875 B
Bash
#!/bin/sh
|
|
|
|
CONFIG=/etc/bind/named.conf
|
|
DAEMON=/usr/sbin/named
|
|
|
|
[ -x $DAEMON ] || exit 0
|
|
[ -f $CONFIG ] || exit 0
|
|
|
|
case "$1" in
|
|
start)
|
|
if [ ! -f /etc/rndc.key ]; then
|
|
printf "Initializing bind control key: "
|
|
# if rndc.key is a symlink, the target must exist
|
|
touch /etc/rndc.key
|
|
rndc-confgen -a -r /dev/urandom 2>/dev/null && echo "OK" || echo "FAIL"
|
|
fi
|
|
printf "Starting domain name daemon: "
|
|
start-stop-daemon -S -x $DAEMON -- -c $CONFIG -u named
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
|
;;
|
|
stop)
|
|
printf "Stopping domain name daemon: "
|
|
rndc stop || start-stop-daemon -K -x $DAEMON
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
|
;;
|
|
restart)
|
|
$0 stop || true
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
reload|force-reload)
|
|
rndc reload || $0 restart
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
|
|
exit 1
|
|
esac
|
|
|
|
exit 0
|