From 8abe950ab80e2d468ba53d73e929b68a6f2fb008 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:38:18 +0100 Subject: [PATCH] dbg[healthcheck] added debugging and timeout handling --- src/health-check.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/health-check.sh b/src/health-check.sh index 970c133d..806463b0 100755 --- a/src/health-check.sh +++ b/src/health-check.sh @@ -3,6 +3,7 @@ #--- Constants ------------------------------------------------------------------------------------------------------- + declare -r PID_FILE="/var/run/health-check.pid" declare -r URL_FILE="/tmp/health-check.urls" declare -r RESULT_FILE="/tmp/health-check.result" @@ -46,7 +47,7 @@ function trapExitHandler() { #====================================================================================================================- #--- Main script ----------------------------------------------------------------------------------------------------- - +set -x [ -e $PID_FILE ] && { echo "Instance already running, aborting another one" ; exit 1; } # run before installing traphandler! trap trapExitHandler SIGTERM EXIT @@ -56,6 +57,8 @@ echo "$$" > $PID_FILE while IFS= read -r fhemUrl; do fhemwebState=$( curl \ + --connect-timeout 5 \ + --max-time 8 \ --silent \ --insecure \ --output /dev/null \ @@ -75,5 +78,4 @@ while IFS= read -r fhemUrl; do fi done < $URL_FILE -exit $gRetVal - +exit $gRetVal \ No newline at end of file