aboutsummaryrefslogtreecommitdiffstats
path: root/main/unbound/unbound.initd
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-12-15 21:21:15 +0100
committerJakub Jirutka <jakub@jirutka.cz>2017-12-15 21:43:19 +0100
commita9bc6431b8246dde29e1f3bc6bbcc73673fad7a1 (patch)
tree9549e94cf89a55b5383a0dde0673cc6fd2b6fffd /main/unbound/unbound.initd
parentd95feb9192bfd592fea2abe460cb9482655be09f (diff)
downloadaports-a9bc6431b8246dde29e1f3bc6bbcc73673fad7a1.tar.gz
aports-a9bc6431b8246dde29e1f3bc6bbcc73673fad7a1.tar.bz2
aports-a9bc6431b8246dde29e1f3bc6bbcc73673fad7a1.tar.xz
main/unbound: fix and improve runscript
* Set pidfile location in runscript. It's OpenRC's job to manage pidfile, not unbound's business. * Use standard checkconfig command for checking config, but keep configtest for backward compatibility.
Diffstat (limited to 'main/unbound/unbound.initd')
-rw-r--r--main/unbound/unbound.initd32
1 files changed, 19 insertions, 13 deletions
diff --git a/main/unbound/unbound.initd b/main/unbound/unbound.initd
index 43cf31a6f1..b58a3e6051 100644
--- a/main/unbound/unbound.initd
+++ b/main/unbound/unbound.initd
@@ -1,19 +1,22 @@
#!/sbin/openrc-run
-name="unbound daemon"
-extra_commands="configtest"
+extra_commands="checkconfig configtest"
extra_started_commands="reload"
+
+name="unbound daemon"
description="unbound is a Domain Name Server (DNS) that is used to resolve host names to IP address."
-description_configtest="Run syntax tests for configuration files only."
+description_checkconfig="Run syntax tests for configuration files only."
description_reload="Kills all children and reloads the configuration."
# Upper case variables are here only for backward compatibility.
: ${cfgfile:=${UNBOUND_CONFFILE:-/etc/unbound/$RC_SVCNAME.conf}}
-command=/usr/sbin/unbound
+command="/usr/sbin/unbound"
command_args="-d $command_args"
command_background=yes
-checkconf=/usr/sbin/unbound-checkconf
+pidfile="/run/$RC_SVCNAME.pid"
+
+required_files="$cfgfile"
depend() {
need net
@@ -22,21 +25,24 @@ depend() {
after auth-dns
}
+checkconfig() {
+ ebegin "Checking $cfgfile"
+ /usr/sbin/unbound-checkconf -f "$cfgfile" >/dev/null
+ eend $?
+}
+
configtest() {
- einfo "Checking: $cfgfile" # don't show errors twice
- pidfile=$($checkconf -o pidfile "$cfgfile" 2>/dev/null)
- $checkconf -f $cfgfile 1>/dev/null
- return $?
+ ewarn "This command is deprecated, use checkconfig instead"
+ checkconfig
}
start_pre() {
- configtest || return $?
- checkpath --directory ${pidfile%/*}
- einfo "Using pidfile: $pidfile"
+ checkconfig
}
reload() {
- configtest || return $?
+ start_pre || return $?
+
ebegin "Reloading $name"
start-stop-daemon --signal HUP --pidfile "$pidfile"
eend $?