mirror of
https://codeberg.org/hyperreal/go-uptime-alert
synced 2024-11-25 12:13:42 +01:00
Add Bash and curl way
This commit is contained in:
parent
213cc81f51
commit
2617224d2e
25
README.md
25
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
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user