blob: bfeef82d46f1540ce9ac7877dcd081cde64540b0 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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"
}
|