aboutsummaryrefslogtreecommitdiffstats
path: root/community/keepalived/keepalived.initd
diff options
context:
space:
mode:
Diffstat (limited to 'community/keepalived/keepalived.initd')
-rw-r--r--community/keepalived/keepalived.initd36
1 files changed, 30 insertions, 6 deletions
diff --git a/community/keepalived/keepalived.initd b/community/keepalived/keepalived.initd
index 760c360c89..ce3d1a3b79 100644
--- a/community/keepalived/keepalived.initd
+++ b/community/keepalived/keepalived.initd
@@ -1,13 +1,23 @@
#!/sbin/openrc-run
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-extra_commands="reload"
+extra_started_commands="data reload stats"
+description_data="Write configuration data to /tmp/keepalived.data"
+description_reload="Close down all interfaces, reload its configuration, and start up with new configuration"
+description_stats="Print statistics info"
+
+: ${cfgfile:="/etc/keepalived/keepalived.conf"}
command="/usr/sbin/keepalived"
-command_args="${KEEPALIVED_OPTS}"
-pidfile="/run/keepalived.pid"
-required_files="/etc/keepalived/keepalived.conf"
+# Note: KEEPALIVED_OPTS is for backward compatibility.
+command_args="
+ --dont-fork
+ --use-file=$cfgfile
+ ${config_id:+"--config-id=$config_id"}
+ ${command_args:-${KEEPALIVED_OPTS:-}}"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+
+required_files="$cfgfile"
depend() {
use logger
@@ -16,8 +26,22 @@ depend() {
use net
}
+data() {
+ ebegin "Writing configuration data to /tmp/keepalived.data"
+ start-stop-daemon --pidfile $pidfile --signal USR1
+ eend $?
+}
+
reload() {
ebegin "Reloading keepalived.conf"
start-stop-daemon --pidfile $pidfile --signal HUP
eend $?
}
+
+stats() {
+ ebegin "Dumping stats"
+ start-stop-daemon --pidfile $pidfile --signal USR2
+ eend $?
+
+ cat /tmp/keepalived.stats
+}