summaryrefslogtreecommitdiffstats
path: root/testing/knot/knot.initd
blob: 37589a1b32b3e11c7d43c1f7242e1c9561751afd (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-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/knot/files/knot.init,v 1.2 2013/08/21 09:23:59 scarabeus Exp $

depend() {
	need net
}

start() {
	checkpath -d -m 0750 -o knot:knot /var/run/knot/ /var/lib/knot/

	ebegin "Starting knot"
	start-stop-daemon --start \
		--pidfile $pidfile --exec $command -- $command_args
	eend $?
}

stop() {
	ebegin "Stopping knot"
	/usr/sbin/knotc stop >/dev/null 2>&1
	# In case remote control is not working
	if [ "$?" != 0 ]; then
		if [ -f $pidfile ]; then
			start-stop-daemon --stop --pidfile $pidfile
		fi
	fi
	ewend $?
}

reload() {
	ebegin "Reloading knot"
	/usr/sbin/knotc reload >/dev/null
	eend $?
}