diff --git a/health.sh b/health.sh new file mode 100644 index 0000000000000000000000000000000000000000..32764e2de7702ea48fa2cabe296f16c5206cd622 --- /dev/null +++ b/health.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Known healthchecks hosters, set URL according to your hoster or your own healthchecks private instance : +# https://cron.roflcopter.fr/ping +# https://hc-ping.com/ +URL=https://hc-ping.com + +CURL=/usr/bin/curl +CURLOPTS="-fsS --retry 3" + +ID=$1 + +nbCars=`echo $ID | wc -c` + +if [ $nbCars -le 1 ]; then + echo "Usage: health.sh [id of check on $URL]" + exit 1 +fi + +$CURL $CURLOPTS $URL/$ID 1>/dev/null 2>&1 +RV=$? + +if [ $RV -ne 0 ]; then + echo "Error: curl returned $RV" +fi + +exit $RV