summaryrefslogtreecommitdiff
path: root/sysutils/beats6/files/packetbeat.in
blob: 5abaf619437a3232e638b1a8e21db97f6753e670 (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
#!/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_conf (str):	packetbeat configuration file
#				Default: ${PREFIX}/etc/packetbeat.yml

. /etc/rc.subr

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

: ${packetbeat_enable:="NO"}
: ${packetbeat_config:="-path.home /var/db/beats/${name} -path.config %%PREFIX%%/etc"}

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

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

run_rc_command "$1"