sysutils/fluent-bit: Improve RC script and fix issues

* Document 'fluent_bit_group' variable
* Install PID file with mode 0600 instead of 0755
* Reuse ${name}
* Pass '-t {name}' to daemon(8)
* Remove self-created PID file

PR:		292782
MFH:		2026Q1
Approved by:	girgen (maintainer)
This commit is contained in:
Michael Osipov
2026-01-28 14:19:47 +01:00
parent a8cce21664
commit efa59bb216
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
PORTNAME= fluent-bit
DISTVERSIONPREFIX= v
DISTVERSION= 4.2.2
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils
MAINTAINER= girgen@FreeBSD.org
+10 -3
View File
@@ -13,6 +13,7 @@
# Default: %%ETCDIR%%/fluent-bit.conf
# fluent_bit_flags (str): Extra flags passed to fluent-bit
# fluent_bit_user (str): Default run as user nobody
# fluent_bit_group (str): Default run as group nogroup
. /etc/rc.subr
@@ -28,16 +29,22 @@ load_rc_config $name
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}"
command_args="-H -p ${pidfile} -o /var/log/${name}/${name}.log -t ${name} ${procname} --quiet --config ${fluent_bit_config} ${fluent_bit_flags}"
start_precmd=fluent_bit_startprecmd
start_precmd="${name}_startprecmd"
stop_postcmd="${name}_stoppostcmd"
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};
install -m 0600 -o ${fluent_bit_user} -g ${fluent_bit_group} /dev/null ${pidfile}
fi
}
fluent_bit_stoppostcmd()
{
rm -f ${pidfile}
}
run_rc_command "$1"