#!/bin/sh # $FreeBSD: head/sysutils/beats7/files/packetbeat.in 551341 2020-10-03 20:03:35Z tcberner $ # 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"