summaryrefslogtreecommitdiff
path: root/sys-cluster/heartbeat/files/3.0.6-r1-heartbeat-init
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/heartbeat/files/3.0.6-r1-heartbeat-init')
-rw-r--r--sys-cluster/heartbeat/files/3.0.6-r1-heartbeat-init95
1 files changed, 95 insertions, 0 deletions
diff --git a/sys-cluster/heartbeat/files/3.0.6-r1-heartbeat-init b/sys-cluster/heartbeat/files/3.0.6-r1-heartbeat-init
new file mode 100644
index 000000000000..5e15b322f503
--- /dev/null
+++ b/sys-cluster/heartbeat/files/3.0.6-r1-heartbeat-init
@@ -0,0 +1,95 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+HA_DIR=/etc/ha.d
+. $HA_DIR/shellfuncs
+HA_DAEMON_DIR=/usr/libexec/heartbeat
+HA_LIB_DIR=/usr/lib/heartbeat
+HA_SHARE_DIR=/usr/share/heartbeat
+
+depend() {
+ use logger
+ need net
+}
+
+opts="start stop status reload restart"
+
+CheckBool() {
+ case `echo "$1" | tr A-Z a-z` in
+ y|yes|enable|on|true|1) true;;
+ *) false;;
+ esac
+}
+
+# Run pre-startup script if it exists
+RunStartStop() {
+ [ -f $HA_DIR/resource.d/startstop ] && $HA_DIR/resource.d/startstop "$@"
+}
+
+start() {
+ checkpath -q -d -m 0755 -o root:root /var/run/heartbeat
+
+ ebegin "Starting heartbeat"
+
+ . $HA_DIR/shellfuncs
+
+ # start the log subsystem
+ CheckBool "`ha_parameter use_logd`" && \
+ ( ${HA_LIB_DIR}/ha_logd -s &>/dev/null || \
+ ${HA_LIB_DIR}/ha_logd -d -c /etc/ha.d/ha_logd.cf)
+
+ RunStartStop pre-start
+
+ CheckBool "`ha_parameter crm`" || \
+ ${HA_SHARE_DIR}/ResourceManager verifyallidle
+
+ ${HA_DAEMON_DIR}/heartbeat &>/dev/null
+ ret=$?
+
+ RunStartStop post-start
+
+ eend ${ret}
+}
+
+stop() {
+ ebegin "Stopping heartbeat"
+
+ RunStartStop pre-stop
+
+ ${HA_DAEMON_DIR}/heartbeat -k &>/dev/null
+ ret=$?
+
+ RunStartStop post-stop ${ret}
+
+ # stop log subsystem
+ CheckBool "`ha_parameter use_logd`" && \
+ ( ${HA_LIB_DIR}/ha_logd -s &>/dev/null && \
+ ${HA_LIB_DIR}/ha_logd -k &>/dev/null )
+
+ eend ${ret}
+}
+
+status() {
+ ${HA_DAEMON_DIR}/heartbeat -s
+}
+
+reload() {
+ ebegin "Reloading heartbeat"
+ ${HA_DAEMON_DIR}/heartbeat -r &>/dev/null
+ eend $?
+}
+
+restart() {
+ . $HA_DIR/shellfuncs
+
+ sleeptime=$(( `ha_parameter deadtime` + 10 ))
+
+ svc_stop
+
+ ebegin " waiting ${sleeptime}s to allow resource takeover to complete"
+ sleep ${sleeptime}
+ eend 0
+
+ svc_start
+}