summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbgo <bgo@9dt.de>2017-05-23 23:44:31 +0200
committerMichał Górny <mgorny@gentoo.org>2017-05-24 00:16:54 +0200
commit0e7456587ffeff7a2922737205caaf3da0a2ee2c (patch)
tree263c99a199b74b95eb316d201017e8cb082b5fdc /net-dns/dnsdist/files/dnsdist.initd
parentprofiles: mask >sys-apps/openrc-0.23.2 on uclibc, bug #619370 (diff)
downloadgentoo-0e7456587ffeff7a2922737205caaf3da0a2ee2c.tar.gz
gentoo-0e7456587ffeff7a2922737205caaf3da0a2ee2c.tar.bz2
gentoo-0e7456587ffeff7a2922737205caaf3da0a2ee2c.zip
net-dns/dnsdist: New package, #611892
Closes: https://github.com/gentoo/gentoo/pull/4606
Diffstat (limited to 'net-dns/dnsdist/files/dnsdist.initd')
-rw-r--r--net-dns/dnsdist/files/dnsdist.initd55
1 files changed, 55 insertions, 0 deletions
diff --git a/net-dns/dnsdist/files/dnsdist.initd b/net-dns/dnsdist/files/dnsdist.initd
new file mode 100644
index 00000000000..bfeef82d46f
--- /dev/null
+++ b/net-dns/dnsdist/files/dnsdist.initd
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="configcheck"
+#extra_started_commands=""
+
+DNSDIST_INSTANCE="${SVCNAME#dnsdist[.-]}"
+DNSDIST_CONFFILE="/etc/dnsdist/${SVCNAME#dnsdist[.-]}.conf"
+DNSDIST="/usr/bin/dnsdist"
+PIDDIR=/run/dnsdist
+PIDFILE=$PIDDIR/$SVCNAME.pid
+
+
+if [ -n "${DNSDIST_INSTANCE}" ] && [ "${DNSDIST_INSTANCE}" != "dnsdist" ]
+then
+ DNSDIST_INSTANCE="dnsdist-${SVCNAME#dnsdist[.-]}"
+ DNSDIST_CONFFILE="/etc/dnsdist/${DNSDIST_INSTANCE}.conf"
+else
+ DNSDIST_INSTANCE="default"
+fi
+
+depend() {
+ need net
+}
+
+start() {
+ checkpath -q -d ${PIDDIR} -o ${DNSDIST_USER}:${DNSDIST_GROUP}
+
+ configcheck || return 1
+
+ ebegin "Starting dnsdist (${DNSDIST_INSTANCE})"
+ start-stop-daemon --start --exec $DNSDIST --pidfile ${PIDFILE} \
+ -- -d -p ${PIDFILE} -u ${DNSDIST_USER} -g ${DNSDIST_GROUP} \
+ -C $DNSDIST_CONFFILE ${DNSDIST_OPTIONS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping dnsdist (${DNSDIST_INSTANCE})"
+ start-stop-daemon --stop --exec $DNSDIST --pidfile ${PIDFILE}
+ eend $?
+}
+
+configcheck() {
+ ebegin "Checking configuration file (${DNSDIST_CONFFILE})"
+ $DNSDIST --check-config -C $DNSDIST_CONFFILE > /dev/null
+
+ if [ $? -ne 0 ]; then
+ $DNSDIST --check-config -C $DNSDIST_CONFFILE
+ fi
+
+ eend $? "failed, please correct errors above"
+}
+