ports/sysutils/fluent-bit/files/fluent-bit.in
Palle Girgensohn 2b5d5148c0 sysutils/fluent-bit: fix problems running the fluent-bit
There is a known problem with the default coro_stack_size being too
small. Double it to avoid failing to start. [1]

Since the daemon option seems to be somewhat funky [2], use daemon to
wrap the fluent-bit binary when running from the rc.d script.

[1] https://github.com/fluent/fluent-bit/issues/3716
PR:	255593 [2]
2021-09-03 00:37:18 +02:00

43 lines
1.1 KiB
Bash

#!/bin/sh
# PROVIDE: fluent-bit
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable fluent-bit:
#
# fluent_bit_enable (bool): Set to YES to enable fluent-bit
# Default: NO
# fluent_bit_config (str): config files to use
# Default: %%ETCDIR%%/fluent-bit.conf
# fluent_bit_flags (str): Extra flags passed to fluent-bit
# fluent_bit_user (str): Default run as user nobody
. /etc/rc.subr
name="fluent_bit"
rcvar=${name}_enable
load_rc_config $name
: ${fluent_bit_enable:="NO"}
: ${fluent_bit_user:="nobody"}
: ${fluent_bit_group:="nogroup"}
: ${fluent_bit_config:="%%ETCDIR%%/fluent-bit.conf"}
pidfile=/var/run/${name}.pid
procname="%%PREFIX%%/bin/fluent-bit"
command="/usr/sbin/daemon"
command_args="-H -p ${pidfile} -o /var/log/${name}/${name}.log ${procname} --quiet --config ${fluent_bit_config} ${fluent_bit_flags} --daemon"
start_precmd=fluent_bit_startprecmd
fluent_bit_startprecmd()
{
install -o ${fluent_bit_user} -g ${fluent_bit_group} -d /var/log/${name}
if [ ! -e ${pidfile} ]; then
install -o ${fluent_bit_user} -g ${fluent_bit_group} /dev/null ${pidfile};
fi
}
run_rc_command "$1"