diff --git a/README.md b/README.md index c290a4d..d748641 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,28 @@ sudo -u user /home/user/go/bin/go-uptime-alert >> "${LOGFILE}" 2>&1 - Send output to a static HTML file and format appropriately for web server. - Send output to a .md file for use in Hugo or other static site generators. + +## Or just use Bash and curl + +``` shell +#!/usr/bin/env bash + +# associative array to store mappings between site URLS and ping URLs. +declare -A sites_hc_urls + +sites_hc_urls["https://hyperreal.coffee"]="https://healthchecks.io/ping/blahblah" +sites_hc_urls["https://anonoverflow.hyperreal.coffee""]="https://healthchecks.io/ping/blahblahblah" +... + +for key in "${!sites_hc_urls[@]}"; do + if curl -sSL -q "$key" >/dev/null 2>&1; then + if curl -m 10 --retry 5 "${sites_hc_urls[$key]}" >/dev/null 2>&1; then + echo "$key: OK" + else + echo "Error sending ping to ${sites_hc_urls[$key]}" + fi + else + echo "$key: DOWN" + fi +done +```