bin/http-status-note
Jeffrey Serio 909594bbd0 Add stuff
2023-12-30 21:04:27 -06:00

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