summaryrefslogtreecommitdiff
blob: 71618a50ed10aa63d13b72e71def729f7924d341 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/sbin/openrc-run

PIDFILE=/var/run/heartbeat-logd.pid

depend() {
	need net
}

BINARY="/usr/%libdir%/heartbeat/ha_logd"
USER="hacluster"
GROUP="haclient"
CONFIG="/etc/logd.cf"
LOGFILE="/var/log/ha_logger.log"

start() {
	ebegin "Starting heartbeat non-blocking log service"

	COMMAND_ARGS="-d"
	[[ -f "${CONFIG}" ]] && COMMAND_ARGS+=" -c ${CONFIG}"

	if [ -n "${RC_UNAME}" ]; then
		PARAMS="--background --stdout '${LOGFILE}' --stderr '${LOGFILE}' -- ${ARGS}"
	else
		PARAMS="-- ${ARGS} >> '${LOGFILE}' 2>&1 &"
	fi
	eval ${CHRT} start-stop-daemon \
		--quiet --start --chdir "${RUNTIMEDIR}" \
		--pidfile "${PIDFILE}" \
		--make-pidfile \
		--exec ${BINARY} ${COMMAND_ARGS} --chuid "${USER}:${GROUP}" \
		--nicelevel "${NICELEVEL}" \
		${PARAMS}
	eend $?
}

stop() {
	ebegin "Stopping heartbeat non-blocking log service"
	start-stop-daemon --stop --retry 3 --quiet --exec "${BINARY}"
	rm -f "${PIDFILE}"
	eend $?
}

restart() {
	stop
	sleep 3
	start
}