From 041735694fbfbea68ece9c09fc59826b8e37d6b8 Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 21 Apr 2023 08:37:39 +0200 Subject: [PATCH] Healthcheck --- run/check.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/run/check.sh b/run/check.sh index da34386..88c39b3 100644 --- a/run/check.sh +++ b/run/check.sh @@ -4,15 +4,19 @@ set -eu # Docker Healthcheck PORT=5000 -IP="20.20.20.21" - FILE="/var/dsm.ip" -[ -f "$FILE" ] && IP=$(cat "${FILE}") -if ! curl -m 3 -ILfSs "http://$IP:$PORT/"; then - echo "Failed to reach $IP" +if [ ! -f "${FILE}" ]; then + echo "IP not assigned" exit 1 fi -echo "Healthcheck OK for $IP" +IP=$(cat "${FILE}") + +if ! curl -m 3 -ILfSs "http://${IP}:${PORT}/"; then + echo "Failed to reach ${IP}" + exit 1 +fi + +echo "Healthcheck OK for ${IP}" exit 0