#!/bin/bash
set -euo pipefail

URL="http://127.0.0.1:8080"

echo "[INFO] Starting Argus web health check loop for $URL..."

while true; do
    if curl -s --max-time 5 "$URL" > /dev/null; then
        echo "[OK] $(date '+%Y-%m-%d %H:%M:%S') Argus web is healthy"
    else
        echo "[ERROR] $(date '+%Y-%m-%d %H:%M:%S') Argus web health check failed"
        exit 1
    fi
    sleep 10
done
