mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-01 16:43:08 +01:00
17 lines
544 B
Plaintext
17 lines
544 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
source /usr/local/etc/matrix-webhook-env
|
||
|
|
||
|
for url in "${site_urls[@]}"; do
|
||
|
status_code=$(curl -o /dev/null -s -w "%{http_code}" "$url")
|
||
|
if [ "$status_code" = 200 ] && ! [ "$status_code" == "302" ]; then
|
||
|
if ! /usr/local/bin/send-matrix-webhook "$room_id" "$url: ✅ UP"; then
|
||
|
echo "Error sending webhook to Matrix"
|
||
|
exit 1
|
||
|
fi
|
||
|
else if ! /usr/local/bin/send-matrix-webhook "$room_id" "$url: ❌ DOWN"; then
|
||
|
echo "Error sending webhook to Matrix"
|
||
|
exit 1
|
||
|
fi
|
||
|
done
|