aboutsummaryrefslogtreecommitdiffstats
path: root/testing/cluster-glue/ha_logd.initd
blob: 13a5bf321a53492d1850e71ce88aabd1a78d7bc7 (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
#!/sbin/runscript

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} --user "${USER}:${GROUP}" \
		${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
}