summaryrefslogtreecommitdiff
path: root/sysutils/beats7/files/packetbeat.in
blob: 842b1c00c154dd0743fb2b3b1501af5130017ccf (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
37
38
39
40
41
42
43
44
#!/bin/sh
# $FreeBSD$

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

# Add the following lines to /etc/rc.conf to enable packetbeat
#
# packetbeat_enable (bool):	Set to YES to enable packetbeat
# 				Default: NO
# packetbeat_flags (str):	Extra flags passed to packetbeat
# packetbeat_config (str):	packetbeat configuration directory
#				Default: ${PREFIX}/etc/beats
# packetbeat_conffile (str):	packetbeat configuration file
#				relative to ${packetbeat_conf}
#				Default: packetbeat.yml

. /etc/rc.subr

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

: ${packetbeat_enable:="NO"}
: ${packetbeat_config:="%%ETCDIR%%"}
: ${packetbeat_conffile:="packetbeat.yml"}
: ${packetbeat_home:="%%DATADIR%%/packetbeat"}
: ${packetbeat_logs:="/var/log/beats"}
: ${packetbeat_data:="/var/db/beats/packetbeat"}

# daemon
start_precmd=packetbeat_prestart
command=/usr/sbin/daemon
pidfile="/var/run/${name}"
command_args="-frP ${pidfile} %%PREFIX%%/sbin/${name} ${packetbeat_flags} --path.config ${packetbeat_config} --path.home ${packetbeat_home} --path.data ${packetbeat_data} --path.logs ${packetbeat_logs} -c ${packetbeat_conffile}"

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

run_rc_command "$1"