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

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

command="/usr/sbin/keepalived"
command_args="${KEEPALIVED_OPTS}"
pidfile="/var/run/keepalived.pid"

extra_commands="checkconfig reload"

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_pre() {
	checkconfig || return 1
}

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