#!/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