#!/bin/bash # Simple Uptime & Service Health Check for VPS # Checks Xray, AdGuard Home, Tailscale, and WireGuard SERVICES=("xray" "AdGuardHome" "tailscaled" "wg-quick@wg0") echo "--- Service Health Check ($(date)) ---" for svc in "${SERVICES[@]}"; do if systemctl is-active --quiet "$svc"; then echo "[OK] $svc is running" else echo "[ERROR] $svc is NOT running!" # Optional: Attempt restart # sudo systemctl restart "$svc" fi done # Check if Xray is listening on 443 if ss -tuln | grep -q ":443 "; then echo "[OK] Port 443 is listening (Xray)" else echo "[ERROR] Port 443 is NOT listening!" fi # Check if AdGuard Home is listening on 53 (Tailscale IP) TAILSCALE_IP="100.70.115.1" if ss -tuln | grep -q "$TAILSCALE_IP:53 "; then echo "[OK] AdGuard Home is listening on $TAILSCALE_IP:53" else echo "[WARNING] AdGuard Home is NOT listening on $TAILSCALE_IP:53" fi echo "--- Check Complete ---"