1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00
freebsd-ports/dns/nsd3/files/nsd.in
Erwin Lansing 17867420bb Please welcome NSD 4.0.0
For all new features, see
http://www.nlnetlabs.nl/svn/nsd/tags/NSD_4_0_0_REL/doc/NSD-4-features

This version replaces the nsdc control program with nsd-control.
This requires some manual setup with nsd-control-setup and editing
of the config files. nsd-control is incompatible with nsdc so when
that is used in scripts, these should be adapted.

NSD 3 is still supported as dns/nsd3.

PR:		183888
Submitted by:	Jaap Akkerhuis <jaap@NLnetLabs.nl>
2013-11-12 13:24:45 +00:00

86 lines
1.4 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nsd
# REQUIRE: DAEMON
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable nsd:
#
# nsd_enable="YES"
#
. /etc/rc.subr
case $0 in
/etc/rc*)
# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
# so get the name of the script from $_file
name=$_file
;;
*)
name=$0
;;
esac
name=${name##*/}
rcvar=${name}_enable
load_rc_config ${name}
eval ": \${${name}_conf:=\"%%PREFIX%%/etc/nsd/${name}.conf\"}"
eval "_conf=\${${name}_conf}"
command=%%PREFIX%%/sbin/nsdc
procname=%%PREFIX%%/sbin/nsd
required_files=${_conf}
pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile ${_conf}`
extra_commands="notify patch rebuild reload update"
notify_cmd="nsd_nsdc_cmd notify"
patch_cmd="nsd_nsdc_cmd patch"
rebuild_cmd="nsd_nsdc_cmd rebuild"
reload_cmd="nsd_reload_cmd"
start_cmd="nsd_start_cmd"
stop_cmd="nsd_stop_cmd"
update_cmd="nsd_nsdc_cmd update"
nsd_nsdc_cmd()
{
${command} -c ${_conf} "$1"
}
nsd_reload_cmd()
{
nsd_nsdc_cmd rebuild && nsd_nsdc_cmd reload
}
nsd_start_cmd()
{
local _db
_db=`%%PREFIX%%/sbin/nsd-checkconf -o database ${_conf}`
if [ ! -f "${_db}" ]; then
nsd_nsdc_cmd rebuild
fi
echo "Starting ${name}."
nsd_nsdc_cmd start
}
nsd_stop_cmd()
{
echo "Merging nsd zone transfer changes to zone files."
nsd_nsdc_cmd patch
echo "Stopping ${name}."
nsd_nsdc_cmd stop
}
run_rc_command "$1"