You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-dns/pdns-recursor/files/pdns-recursor-r2

48 lines
1.4 KiB

#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
get_config_option() {
awk -v option="${1}" -F = '$1 == option { print $2 }' "${PDNS_CONFIG}"
}
PDNS_CONFIGDIR="${PDNS_CONFIGDIR:-/etc/powerdns}"
PDNS_CONFIG="${PDNS_CONFIGDIR}/recursor.conf"
PDNS_CHROOTDIR="$( get_config_option chroot )"
PDNS_SOCKETDIR="$( get_config_option socket-dir )"
PDNS_SETUID="$( get_config_option setuid )"
PDNS_SETGID="$( get_config_option setgid )"
[ -z "${PDNS_SOCKETDIR}" -a -z "${PDNS_CHROOTDIR}" ] && PDNS_SOCKETDIR="/var/run/pdns-recursor"
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} --write-pid=yes"
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
}
start_pre() {
checkpath --directory --owner "${PDNS_SETUID:-root}:${PDNS_SETGID:-root}" --mode 750 "${PDNS_CHROOTDIR}/${PDNS_SOCKETDIR}"
}
ping() {
ebegin "Pinging ${name}"
${control_command} ${control_command_args} ping >/dev/null 2>&1
eend $?
}