aboutsummaryrefslogtreecommitdiffstats
path: root/testing/knot/knotd.initd
blob: 49309869e5835829eade7c39d865140be27978b8 (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
#!/sbin/openrc-run
# 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 $

name="knotd"
command="/usr/sbin/knotd"
command_args="-d ${KNOTD_OPTS}"
start_stop_daemon_args="--wait 5"
required_files=/etc/knot/knot.conf
extra_started_commands="reload"
description_reload="Reload configuration and changed zones"

depend() {
	need net
}

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

stop() {
	ebegin "Stopping ${name}"
	/usr/sbin/knotc stop >/dev/null 2>&1
	# Mark service as stopped if remote control was successful
	if [ 0 -eq $? ]; then
		start-stop-daemon --stop --quiet --pidfile /var/run/knot/knot.pid
	fi
	eend $?
}

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