From 717bf7b434437ecf82b9af46c1e7e07b8d36f16e Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:45:31 +1200 Subject: [PATCH] fix: Tail start offset should be lines + 1 0 or 1 is equivalent for a fresh file, but when log lines already exist, you want to start from the line after the last one, not at it. Thus always increment the count by 1. --- target/scripts/start-mailserver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/scripts/start-mailserver.sh b/target/scripts/start-mailserver.sh index 3cd54696..271bc621 100755 --- a/target/scripts/start-mailserver.sh +++ b/target/scripts/start-mailserver.sh @@ -199,7 +199,7 @@ MAIN_LOGFILE=/var/log/mail/mail.log # NOTE: rsyslogd would usually create this later during `_start_daemons`, however it would already exist if the container was restarted. touch "${MAIN_LOGFILE}" # Ensure `tail` follows the correct position of the log file for this container start (new logs begin once `_start_daemons` is called) -TAIL_START=$(wc -l < "${MAIN_LOGFILE}") +TAIL_START=$(( $(wc -l < "${MAIN_LOGFILE}") + 1 )) [[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment _start_daemons