]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
util: health-check.sh - Don't leave "sleep 10" process running
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Oct 2025 11:09:45 +0000 (14:09 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 21 Oct 2025 08:57:46 +0000 (08:57 +0000)
src/util/health-check.sh

index 4604f4e12f82c8ff40cb125133d29102f3fad855..99f9299bec1160a985de8fa3888dce2c59916bf7 100755 (executable)
@@ -20,9 +20,14 @@ trap "exit 0" QUIT
        sleep $timeout
        kill -3 $$ 2>/dev/null
 } &
-read -r input
+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