summaryrefslogtreecommitdiff
path: root/net-dns/knot-resolver/files/knot-resolver.initd
blob: 79c9ec786a8ba469c08ca8c9f59a6798ae3ad485 (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 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

: ${KNOT_RESOLVER_USER:=knot-resolver}
: ${KNOT_RESOLVER_GROUP:=knot-resolver}
: ${KNOT_RESOLVER_CONFIG:=/etc/knot-resolver/config.yaml}
: ${KNOT_RESOLVER_PIDFILE:=/run/knot-resolver.pid}
: ${KNOT_RESOLVER_LOG:=syslog}

export KRES_LOGGING_TARGET="${KNOT_RESOLVER_LOG}"

command="/usr/bin/knot-resolver"
command_args="-c ${KNOT_RESOLVER_CONFIG}"
command_user="${KNOT_RESOLVER_USER}:${KNOT_RESOLVER_GROUP}"
pidfile="${KNOT_RESOLVER_PIDFILE}"
command_background=true
retry="TERM/60/KILL/5"

extra_started_commands="reload"

capabilities="^cap_net_bind_service,^cap_setpcap"

name="knot-resolver manager"
description="scaleable caching DNS resolver"

depend() {
    need net
    use logger
    provide dns
}

reload() {
	ebegin "Reloading ${SVCNAME}"
	/usr/bin/kresctl --config=${KNOT_RESOLVER_CONFIG} reload
	eend $?
}