mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-09-30 22:52:36 +00:00
Use localhost for consistency and fix timing to report 0 seconds when ready immediately
Co-authored-by: DerLinkman <62480600+DerLinkman@users.noreply.github.com>
This commit is contained in:
co-authored by
DerLinkman
parent
de3d617840
commit
322841cbeb
@@ -103,7 +103,7 @@ echo "Waiting up to ${STARTUP_GRACE_PERIOD} seconds for clamd to start up..."
|
|||||||
|
|
||||||
# Helper function to check if clamd is ready
|
# Helper function to check if clamd is ready
|
||||||
clamd_is_ready() {
|
clamd_is_ready() {
|
||||||
echo "PING" | nc -w 1 127.0.0.1 3310 2>/dev/null | grep -q "PONG"
|
[ "$(echo "PING" | nc -w 1 localhost 3310 2>/dev/null)" = "PONG" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wait for clamd to be ready or until timeout
|
# Wait for clamd to be ready or until timeout
|
||||||
@@ -120,11 +120,11 @@ while [ ${ELAPSED} -lt ${STARTUP_GRACE_PERIOD} ]; do
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep ${POLL_INTERVAL}
|
|
||||||
ELAPSED=$((ELAPSED + POLL_INTERVAL))
|
ELAPSED=$((ELAPSED + POLL_INTERVAL))
|
||||||
|
sleep ${POLL_INTERVAL}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Report final status
|
# Report final status only if not already reported as ready
|
||||||
if [ ${CLAMD_READY} -eq 0 ]; then
|
if [ ${CLAMD_READY} -eq 0 ]; then
|
||||||
if clamd_is_ready; then
|
if clamd_is_ready; then
|
||||||
echo "clamd is now ready (started during final check)"
|
echo "clamd is now ready (started during final check)"
|
||||||
|
|||||||
Reference in New Issue
Block a user