mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-25 10:23:42 +01:00
17 lines
544 B
Bash
Executable File
17 lines
544 B
Bash
Executable File
#!/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
|