aboutsummaryrefslogtreecommitdiffstats
path: root/community/pdns/pdns.initd
blob: 88d8b28f2606f76061d785e16498db35c3f26d56 (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
#!/sbin/openrc-run

pdns_control=/usr/bin/pdns_control

PDNS_INSTANCE="${SVCNAME#pdns[.-]}"
PDNS_CONFIG=""

if [ -n "${PDNS_INSTANCE}" ] && [ "${PDNS_INSTANCE}" != "pdns" ]
then
	PDNS_CONFIG="--config-name=${PDNS_INSTANCE}"
else
	PDNS_INSTANCE="default"
fi

command="/usr/sbin/pdns_server"
command_args="--guardian=no --daemon=no --write-pid=no $PDNS_CONFIG"
command_background="yes"
extra_started_commands="dump reload"
pidfile="/run/$RC_SVCNAME.pid"

depend() {
	need net
	after firewall
}

reload() {
	ebegin "Reloading PowerDNS (${PDNS_INSTANCE})"
	${pdns_control} ${PDNS_CONFIG} cycle &>/dev/null
	eend $?
}

dump() {
	ebegin "Dumping PowerDNS (${PDNS_INSTANCE}) variables"
	${pdns_control} ${PDNS_CONFIG} list
	eend $?
}