FreeBSD/jails/config/elk/rc.d/filebeat

44 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-12-03 17:32:20 -08:00
#!/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_config (str): filebeat configuration directory
# Default: ${PREFIX}/etc/beats
# filebeat_conffile (str): filebeat configuration file
# relative to ${filebeat_conf}
# Default: filebeat.yml
. /etc/rc.subr
name="filebeat"
rcvar=${name}_enable
load_rc_config $name
: ${filebeat_enable:="NO"}
: ${filebeat_config:="/usr/local/etc/beats"}
: ${filebeat_conffile:="filebeat.yml"}
: ${filebeat_home:="/usr/local/share/beats/filebeat"}
: ${filebeat_logs:="/var/log/beats"}
: ${filebeat_data:="/var/db/beats/filebeat"}
# daemon
start_precmd=filebeat_prestart
command=/usr/sbin/daemon
pidfile="/var/run/${name}"
command_args="-frP ${pidfile} /usr/local/sbin/${name} ${filebeat_flags} --path.config ${filebeat_config} --path.home ${filebeat_home} --path.data ${filebeat_data} --path.logs ${filebeat_logs} -c ${filebeat_conffile}"
filebeat_prestart() {
# Have to empty rc_flags so they don't get passed to daemon(8)
rc_flags=""
}
run_rc_command "$1"