summaryrefslogtreecommitdiff
path: root/net-dns/pdns-recursor/files/pdns-recursor-r1
blob: 57c9df1eaa453f5f1bd3bfdad184f2ebcae69c41 (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
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

PDNS_CONFIGDIR="${PDNS_CONFIGDIR:-/etc/powerdns}"

PDNS_CONFIG="${PDNS_CONFIGDIR}/recursor.conf"
PDNS_CHROOTDIR="$( awk -F = '$1 == "chroot" { print $2 }' "${PDNS_CONFIG}" )"
PDNS_SOCKETDIR="$( awk -F = '$1 == "socket-dir" { print $2 }' "${PDNS_CONFIG}" )"
[ -z "${PDNS_SOCKETDIR}" -a -z "${PDNS_CHROOTDIR}" ] && PDNS_SOCKETDIR="/var/run"

name="PowerDNS Recursor"
description="Recursive name server"

extra_started_commands="ping"
description_ping="Ping the PowerDNS instance"

command="/usr/sbin/pdns_recursor"
command_args="--config-dir=${PDNS_CONFIGDIR}"
command_args_foreground="--daemon=no"
command_args_background="--daemon=yes"
yesno ${rc_verbose} || command_args_background="${command_args_background} >/dev/null 2>&1"

pidfile="${PDNS_CHROOTDIR}/${PDNS_SOCKETDIR}/pdns_recursor.pid"

control_command="/usr/bin/rec_control"
control_command_args="${command_args}"

depend() {
	need net
}

ping() {
	ebegin "Pinging ${name}"
	${control_command} ${control_command_args} ping >/dev/null 2>&1
	eend $?
}