summaryrefslogtreecommitdiff
path: root/net/djbdns-run/files/djbdns.sh
blob: c14352323e484367fd601067e651c0deb6dbfb0d (plain)
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
63
64
65
66
67
68
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: djbdns.sh,v 1.1 2005/04/15 05:15:55 schmonz Exp $
#
# @PKGNAME@ master script for administrators to control djbdns
# services.
#
# For Red Hat chkconfig
# chkconfig: - 55 45
# description: DJB's collection of DNS tools
#

# KEYWORD: nostart

if [ -f /etc/rc.subr ]; then
	. /etc/rc.subr
fi

rcd_dir=`@DIRNAME@ $0`

# NOTE: run_rc_command sets $rc_arg
#
forward_commands()
{
	# Backward compat with NetBSD <1.6:
	[ -z "$rc_arg" ] && rc_arg=$_arg

	for file in $COMMAND_LIST; do
		$rcd_dir/$file $rc_arg
	done
}

reverse_commands()
{
	# Backward compat with NetBSD <1.6:
	[ -z "$rc_arg" ] && rc_arg=$_arg

	REVCOMMAND_LIST=
	for file in $COMMAND_LIST; do
		REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
	done
	for file in $REVCOMMAND_LIST; do
		$rcd_dir/$file $rc_arg
	done
}

djbdnsrcd()
{
	for service in $@; do
		$rcd_dir/${service} $rc_arg
	done
}

COMMAND_LIST="axfrdns dnscache rbldns tinydns"

name="djbdns"
start_cmd="forward_commands"
stop_cmd="reverse_commands"
reload_cmd="djbdnsrcd axfrdns rbldns tinydns"; cdb_cmd=${reload_cmd}
status_cmd="forward_commands"
extra_commands="status cdb reload"

if [ -f /etc/rc.subr ]; then
	run_rc_command "$1"
else
	_arg="$1"
	${start_cmd}
fi