summaryrefslogtreecommitdiff
path: root/sysutils/beats7/files/heartbeat.in
blob: d99374ab011cd6a4b3f543bbdb5cd4e1c1a0e314 (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
#!/bin/sh

# PROVIDE: heartbeat
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable heartbeat:
#
# heartbeat_enable (bool):	Set to YES to enable heartbeat
# 				Default: NO
# heartbeat_flags (str):	Extra flags passed to heartbeat
# heartbeat_config (str):	heartbeat configuration directory
#				Default: ${PREFIX}/etc/beats
# heartbeat_conffile (str):	heartbeat configuration file
#				relative to ${heartbeat_conf}
#				Default: heartbeat.yml

. /etc/rc.subr

name="heartbeat"
rcvar=${name}_enable
load_rc_config $name

: ${heartbeat_enable:="NO"}
: ${heartbeat_config:="%%ETCDIR%%"}
: ${heartbeat_conffile:="heartbeat.yml"}
: ${heartbeat_home:="%%DATADIR%%/heartbeat"}
: ${heartbeat_logs:="/var/log/beats"}
: ${heartbeat_data:="/var/db/beats/heartbeat"}


# daemon
start_precmd=heartbeat_prestart
command=/usr/sbin/daemon
pidfile="/var/run/${name}"
command_args="-frP ${pidfile} %%PREFIX%%/sbin/${name} ${heartbeat_flags} --path.config ${heartbeat_config} --path.home ${heartbeat_home} --path.data ${heartbeat_data} --path.logs ${heartbeat_logs} -c ${heartbeat_conffile}"

heartbeat_prestart() {
# Have to empty rc_flags so they don't get passed to daemon(8)
	rc_flags=""
}

run_rc_command "$1"