From 154ec78c0391e37596469ec1c56ed514f44c665e Mon Sep 17 00:00:00 2001 From: azarouski Date: Mon, 3 Jun 2024 14:39:57 +0200 Subject: [PATCH] healthcheck logic was edited --- entrypoint.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 791894e..25131fa 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -141,7 +141,15 @@ fi #### Healthcheck -logger "Connecting to ${WDA_HOST} ${MJPEG_PORT} using netcat..." -nc "${WDA_HOST}" "${MJPEG_PORT}" -logger "WARN" "${WDA_HOST} ${MJPEG_PORT} connection closed. Restarting." +while :; do + sleep $WDA_WAIT_TIMEOUT + curl -Is "http://${WDA_HOST}:${WDA_PORT}/status" | head -1 | grep -q '200 OK' + if [[ $? -eq 0 ]]; then + logger "Wda is healthy." + else + logger "ERROR" "WDA is unhealthy. Restarting." + break + fi +done + exit 1