aboutsummaryrefslogtreecommitdiffstats
path: root/testing/powerdns/powerdns.initd
blob: 2c149361db00a2572f70d647497bb0c1d4c16f40 (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
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/pdns/files/pdns,v 1.11 2011/12/04 10:12:32 swegener Exp $

extra_commands="monitor"
extra_started_commands="reload dump"

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

depend() {
	need net
}

start() {
	ebegin "Starting PowerDNS (${PDNS_INSTANCE})"
	/usr/sbin/pdns_server \
		${PDNS_CONFIG} \
		--daemon=yes \
		--guardian=yes
	eend $?
}

stop() {
	ebegin "Stopping PowerDNS (${PDNS_INSTANCE})"
	/usr/bin/pdns_control ${PDNS_CONFIG} quit &>/dev/null
	eend $?
}

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

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

monitor() {
	ebegin "Starting PowerDNS (${PDNS_INSTANCE}) in monitor mode"
	/usr/sbin/pdns_server \
		${PDNS_CONFIG} \
		--daemon=no \
		--guardian=no \
		--control-console=yes \
		--loglevel=9 \
		--log-dns-details=yes \
		--query-logging=yes
	eend $?
}