aboutsummaryrefslogtreecommitdiffstats
path: root/testing/keepalived/keepalived.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/keepalived/keepalived.initd')
-rwxr-xr-xtesting/keepalived/keepalived.initd38
1 files changed, 23 insertions, 15 deletions
diff --git a/testing/keepalived/keepalived.initd b/testing/keepalived/keepalived.initd
index a5b2bb9f98..c290c9dbc5 100755
--- a/testing/keepalived/keepalived.initd
+++ b/testing/keepalived/keepalived.initd
@@ -1,25 +1,33 @@
-#!/sbin/runscript
-# Copyright 1999-2008 Gentoo Foundation
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-KEEPALIVED_BIN="/usr/sbin/keepalived"
-KEEPALIVED_CFG=${KEEPALIVED_CFG:-/etc/keepalived/keepalived.conf}
-
depend() {
use logger
- need net
- after firewall
+ # The interfaces do not actually need to exist to start, it handles them gracefully.
+ use net
}
-start() {
- ebegin "Starting keepalived"
- start-stop-daemon --start --exec "${KEEPALIVED_BIN}" \
- -- -f "${KEEPALIVED_CFG}" ${KEEPALIVED_OPTS}
- eend $?
+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
}
-stop() {
- ebegin "Stopping keepalived"
- start-stop-daemon --stop --exec "${KEEPALIVED_BIN}"
+reload() {
+ ebegin "Reloading keepalived.conf"
+ start-stop-daemon --pidfile $pidfile --signal HUP
eend $?
}