From: Timo Sirainen Date: Fri, 31 Oct 2025 12:44:18 +0000 (+0200) Subject: util: health-check.sh - Use a cleaner way to kill sleep X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d662b6e225388e0e15bba225bac6640c9de6610f;p=thirdparty%2Fdovecot%2Fcore.git util: health-check.sh - Use a cleaner way to kill sleep With the 6ee85b80857d241622a349aac47d51b70b27cc46 approach it introduced errors like: Error: ... Terminated { sleep $timeout; kill -3 $$ 2> /dev/null; } --- diff --git a/src/util/health-check.sh b/src/util/health-check.sh index 99f9299bec..36702a7c75 100755 --- a/src/util/health-check.sh +++ b/src/util/health-check.sh @@ -16,6 +16,8 @@ timeout=10 # timeout the read via trap for POSIX shell compatibility trap "exit 0" QUIT +trap 'kill $timeout_pid 2>/dev/null' EXIT INT TERM + { sleep $timeout kill -3 $$ 2>/dev/null @@ -25,9 +27,6 @@ timeout_pid=$! read -r input exit_code=$? -# Kill the background sleep process -kill $timeout_pid 2>/dev/null - cleaned_input=$(echo ${input} | sed "s/[^a-zA-Z0-9]//g") if [ ${exit_code} -eq 0 ] && [ "${cleaned_input}" = "PING" ];then