Files
hermes-recovery/scripts/wisp-backup/home-router-watchdog.sh
T

23 lines
553 B
Bash
Executable File

#!/bin/bash
# home-router-watchdog.sh — Check home router via WireGuard tunnel
# Silent on success (no_agent mode). Alerts only on failure.
TUNNEL_IP="10.77.0.2"
PING_COUNT=6
PING_INTERVAL=10
SUCCESS=0
for i in $(seq 1 $PING_COUNT); do
if ping -c 1 -W 5 "$TUNNEL_IP" >/dev/null 2>&1; then
SUCCESS=$((SUCCESS + 1))
if [ "$SUCCESS" -ge 2 ]; then
exit 0
fi
fi
sleep "$PING_INTERVAL"
done
echo "[-] Home router offline — not responding through WireGuard tunnel"
echo "[-] Router IP: $TUNNEL_IP"
exit 1