summaryrefslogtreecommitdiff
path: root/etc/rc.d/unbound
blob: 378031b90e0fa306e49e2df2879a735ca9bb7632 (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
#!/bin/sh
#
# $OpenBSD: unbound,v 1.3 2015/07/19 17:31:21 sthen Exp $

daemon="/usr/sbin/unbound"
daemon_flags="-c /var/unbound/etc/unbound.conf"

. /etc/rc.d/rc.subr

pexp="unbound${daemon_flags:+ ${daemon_flags}}"

rc_pre() {
	if grep '^[[:space:]]*auto-trust-anchor-file:' \
            /var/unbound/etc/unbound.conf > /dev/null 2>&1; then
		/usr/sbin/unbound-anchor -v || true
	fi
}

rc_start() {
	/usr/sbin/unbound-checkconf > /dev/null && \
	    ${rcexec} "unbound ${daemon_flags}"
}

rc_cmd $1