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

opts="reload"

depend() {
	use logger
	# The interfaces do not actually need to exist to start, it handles them gracefully.
	use net 
}

extra_commands="checkconfig"

PIDFILE=/var/run/keepalived.pid

checkconfig() {
	# keepalived has a config check command, but it does not work while the daemon is running!
	if [ ! -e /etc/keepalived/keepalived.conf ] ; then
		eerror "You need an /etc/keepalived/keepalived.conf file to run keepalived"
		return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting Keepalived"
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
		--exec /usr/sbin/keepalived -- $opts
	eend $?
}

stop() {
	ebegin "Stopping Keepalived"
	start-stop-daemon --stop --quiet --pidfile $PIDFILE
	eend $?
}

reload() {
	ebegin "Reloading keepalived.conf"
	start-stop-daemon --pidfile $PIDFILE --signal HUP
	eend $?
}