Skip to content

Commit

Permalink
dbg[healthcheck] added debugging and timeout handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sidey79 committed Mar 21, 2024
1 parent 37a0a84 commit 8abe950
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/health-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand All @@ -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 \
Expand All @@ -75,5 +78,4 @@ while IFS= read -r fhemUrl; do
fi
done < $URL_FILE

exit $gRetVal

exit $gRetVal

0 comments on commit 8abe950

Please sign in to comment.