summaryrefslogtreecommitdiff
path: root/sysutils/beats6/files/filebeat.in
blob: 41012f8f72e6cf82bdcbe232fc2fb826cdf8c2f9 (plain) (blame)
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
#!/bin/sh

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

# Add the following lines to /etc/rc.conf to enable filebeat:
#
# filebeat_enable (bool):	Set to YES to enable filebeat
# 				Default: NO
# filebeat_flags (str):		Extra flags passed to filebeat
# filebeat_conf (str):		filebeat configuration file
#				Default: ${PREFIX}/etc/filebeat.yml

. /etc/rc.subr

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

: ${filebeat_enable:="NO"}
: ${filebeat_config:="-path.home %%DATADIR%%/${name} -path.config %%PREFIX%%/etc"}

# daemon
start_precmd=filebeat_prestart
command=/usr/sbin/daemon
pidfile="/var/run/${name}"
command_args="-rfP ${pidfile} %%PREFIX%%/sbin/${name} ${filebeat_config}"

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

run_rc_command "$1"