summaryrefslogtreecommitdiff
blob: 0a6dfd0cc53ee5ededc67851d68316defd78938b (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-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

opts="reload"

EXE=bird
SOCK="/var/run/${EXE}.ctl"

depend() {
	need net
	use logger
}

checkconfig() {
	if [ ! -f "/etc/${EXE}.conf" ]; then
		eerror "Please create /etc/${EXE}.conf"
		return 1
	fi
	return 0
}

start() {
	checkconfig || return $?
	ebegin "Starting BIRD"
	start-stop-daemon --start --exec /usr/sbin/${EXE} -- -c "/etc/${EXE}.conf" -s "${SOCK}"
	eend $? "Failed to start BIRD"
}

stop() {
	ebegin "Stopping BIRD"
	start-stop-daemon --stop --exec /usr/sbin/${EXE}
	eend $? "Failed to stop BIRD"
}

reload() {
	service_started "${SVCNAME}" || return
	ebegin "Reloading BIRD"
	start-stop-daemon --stop --signal HUP --oknodo --exec /usr/sbin/${EXE}
	eend $? "Failed to reload BIRD"
}