View | Details | Raw Unified | Return to bug 176156
Collapse All | Expand All

(-)files/nsd.in (-22 / +48 lines)
Lines 14-58 Link Here
14
14
15
. /etc/rc.subr
15
. /etc/rc.subr
16
16
17
name=nsd
17
case $0 in
18
rcvar=nsd_enable
18
/etc/rc*)
19
	# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
20
	# so get the name of the script from $_file
21
	name=$_file
22
	;;
23
*)
24
	name=$0
25
	;;
26
esac
19
27
20
required_files=%%PREFIX%%/etc/nsd/nsd.conf
28
name=${name##*/}
21
29
22
command=%%PREFIX%%/sbin/nsdc
30
rcvar=${name}_enable
23
command_args="start"
24
pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile %%PREFIX%%/etc/nsd/nsd.conf`
25
procname=%%PREFIX%%/sbin/${name}
26
31
27
load_rc_config ${name}
32
load_rc_config ${name}
28
33
29
nsd_enable=${nsd_enable-"NO"}
34
eval ": \${${name}_conf:=\"%%PREFIX%%/etc/nsd/${name}.conf\"}"
35
eval "_conf=\${${name}_conf}"
36
37
command=%%PREFIX%%/sbin/nsdc
38
procname=%%PREFIX%%/sbin/nsd
39
40
required_files=${_conf}
41
pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile ${_conf}`
42
43
extra_commands="notify patch rebuild reload update"
30
44
31
extra_commands="reload"
45
notify_cmd="nsd_nsdc_cmd notify"
32
start_precmd="nsd_precmd"
46
patch_cmd="nsd_nsdc_cmd patch"
33
reload_cmd="nsd_reload"
47
rebuild_cmd="nsd_nsdc_cmd rebuild"
34
stop_cmd="nsd_stop"
48
reload_cmd="nsd_reload_cmd"
49
start_cmd="nsd_start_cmd"
50
stop_cmd="nsd_stop_cmd"
51
update_cmd="nsd_nsdc_cmd update"
35
52
36
nsd_precmd()
53
nsd_nsdc_cmd()
37
{
54
{
38
	db=`%%PREFIX%%/sbin/nsd-checkconf -o database %%PREFIX%%/etc/nsd/nsd.conf`
55
	${command} -c ${_conf} "$1"
39
	if [ ! -f "$db" ]; then
40
		${command} rebuild
41
	fi
42
}
56
}
43
57
44
nsd_reload()
58
nsd_reload_cmd()
45
{
59
{
46
	${command} rebuild && ${command} reload
60
	nsd_nsdc_cmd rebuild && nsd_nsdc_cmd reload
61
}
62
63
nsd_start_cmd()
64
{
65
	local _db
66
	_db=`%%PREFIX%%/sbin/nsd-checkconf -o database ${_conf}`
67
	if [ ! -f "${_db}" ]; then
68
		nsd_nsdc_cmd rebuild
69
	fi
70
71
	echo "Starting ${name}."
72
	nsd_nsdc_cmd start
47
}
73
}
48
74
49
nsd_stop()
75
nsd_stop_cmd()
50
{
76
{
51
	echo "Merging nsd zone transfer changes to zone files."
77
	echo "Merging nsd zone transfer changes to zone files."
52
	${command} patch
78
	nsd_nsdc_cmd patch
53
79
54
	echo "Stopping ${name}."
80
	echo "Stopping ${name}."
55
	${command} stop
81
	nsd_nsdc_cmd stop	
56
}
82
}
57
83
58
run_rc_command "$1"
84
run_rc_command "$1"

Return to bug 176156