aboutsummaryrefslogtreecommitdiffstats
path: root/testing/keepalived/keepalived.initd
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2016-01-09 22:13:21 +0100
committerSören Tempel <soeren+git@soeren-tempel.net>2016-01-09 22:22:02 +0100
commit3e795e3cccb4f24cd76673faafea26e92de9b3d1 (patch)
treef0066d6fd349061eb3981c9fdb47a99c62a83717 /testing/keepalived/keepalived.initd
parent4828bf93bc15c9c2e47f09534ceee9f80c65bbb2 (diff)
downloadaports-3e795e3cccb4f24cd76673faafea26e92de9b3d1.tar.bz2
aports-3e795e3cccb4f24cd76673faafea26e92de9b3d1.tar.xz
testing/keepalived: upgrade to 1.2.19
Also use new OpenRC services from Gentoo Linux.
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 $?
}