summaryrefslogtreecommitdiff
blob: 2ca0b8e62b579dc0c245c3d1fecd99dfa4e2f6d0 (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
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

command=/usr/sbin/knotd
command_args="-d"
pidfile=/var/run/knot/knot.pid
required_files=/etc/knot/knot.conf
extra_started_commands="reload"
description_reload="Reload configuration and changed zones."

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 "Stoping 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 $?
}