1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-14 07:43:06 +00:00
freebsd-ports/dns/nsd/files/nsd.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

60 lines
937 B
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
name=nsd
rcvar=nsd_enable
required_files=%%PREFIX%%/etc/nsd/nsd.conf
command=%%PREFIX%%/sbin/nsdc
command_args="start"
pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile %%PREFIX%%/etc/nsd/nsd.conf`
procname=%%PREFIX%%/sbin/${name}
load_rc_config ${name}
nsd_enable=${nsd_enable-"NO"}
extra_commands="reload"
start_precmd="nsd_precmd"
reload_cmd="nsd_reload"
stop_cmd="nsd_stop"
nsd_precmd()
{
db=`%%PREFIX%%/sbin/nsd-checkconf -o database %%PREFIX%%/etc/nsd/nsd.conf`
if [ ! -f "$db" ]; then
${command} rebuild
fi
}
nsd_reload()
{
${command} rebuild && ${command} reload
}
nsd_stop()
{
echo "Merging nsd zone transfer changes to zone files."
${command} patch
echo "Stopping ${name}."
${command} stop
}
run_rc_command "$1"