iopsys-feed/logmngr/files/etc/hotplug.d/ntp/20-reload_fluent_bit
Vivek Dutta 362bb8b1cf
logmngr: reload fluent-bit on ntp sync event (via hotplug)
(cherry picked from commit bdc435c392)

Co-authored-by: Mohd Husaam Mehdi <husaam.mehdi@iopsys.eu>
2025-12-04 19:41:25 +05:30

14 lines
375 B
Bash

#!/bin/sh
# This hotplug script reloads fluent-bit, so that kmsg logs' timestamp gets in sync
[ "$ACTION" = stratum ] || exit 0
# only once
if ! uci -q get time.global.first_use_date > /dev/null 2>&1; then
flb_pid="$(pidof fluent-bit)"
if [ -n "$flb_pid" ]; then
logger -t "logmngr.hotplug" -p info "reload fluent-bit due to ntp sync"
kill -SIGHUP "$flb_pid"
fi
fi