1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: nsd3
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start NSD3
# Description: Provides an authoritative only Name Server Daemon.
### END INIT INFO
test -x /usr/sbin/nsd || exit 0
. /lib/lsb/init-functions
nsd_cfg() {
res=$(/usr/sbin/nsd-checkconf -o "$1" /etc/nsd3/nsd.conf)
echo ${res:-"$2"}
}
nsdc_log() {
log_begin_msg "$2"
/usr/sbin/nsdc "$1" > /dev/null
log_end_msg $?
}
case "$1" in
start)
if test \! -f /etc/nsd3/nsd.conf; then
log_begin_msg "Not starting nsd3 due to missing configuration file."
log_end_msg 0
exit 0
fi
case "$(nsd_cfg pidfile)" in
/var/run/nsd3/*)
mkdir -p /var/run/nsd3 && chown "$(nsd_cfg username nsd)" /var/run/nsd3
;;
esac
if test \! -f "$(nsd_cfg database /var/lib/nsd3/nsd.db)"; then
nsdc_log rebuild "Building nsd3 zones..."
fi
nsdc_log start "Starting nsd3..."
;;
stop)
nsdc_log stop "Stopping nsd3..."
;;
force-reload|restart)
nsdc_log restart "Restarting nsd3..."
;;
notify|rebuild|update)
/usr/sbin/nsdc "$1"
;;
*)
opts=`grep '^ *[a-z|-]*)$' "$0" | tr -d ' \n' | tr ')' '|'`
echo "Usage: /etc/init.d/nsd3 {${opts%|}}" >&2
exit 1
;;
esac
exit 0
|