summaryrefslogtreecommitdiff
blob: 9708761917313714d6147f57d7035b2e243a2541 (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
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

MYDNS_CHECKCONF="/usr/bin/mydnscheck"
MYDNS_CONFFILE="${MYDNS_CONFFILE:-/etc/mydns.conf}"

command="/usr/sbin/mydns"
command_args="--background --conf=${MYDNS_CONFFILE} ${MYDNS_EXTRA_OPTS}"
extra_commands="configtest"
extra_started_commands="reload"
pidfile="$(grep '^pidfile' ${MYDNS_CONFFILE} | sed -e 's/^pidfile\s*=\s*\([^# 	]\+\?\)\s*\(#.*\)\?$/\1/')"
pidfile="${pidfile:-/var/run/mydns.pid}"

depend() {
	need net
	use logger mysql postgresql
}

checkconfig() {
	"${MYDNS_CHECKCONF}" --conf="${MYDNS_CONFFILE}"
	return $?
}

configtest() {
	ebegin "Checking ${SVCNAME} configuration"
	checkconfig
	eend $?
}

reload() {
	ebegin "Reloading ${SVCNAME}"
	start-stop-daemon --signal HUP --pidfile "${pidfile}"
	eend $?
}