diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /net-dns/dnsdist/files/dnsdist.initd |
reinit the tree, so we can have metadata
Diffstat (limited to 'net-dns/dnsdist/files/dnsdist.initd')
-rw-r--r-- | net-dns/dnsdist/files/dnsdist.initd | 55 |
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 000000000000..bfeef82d46f1 --- /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" +} + |