#!/bin/bash # 看可靠性测试进度和隧道事件 set -u echo "── 测试进程 ──" pgrep -af 'tpr.sh|reliability' | head -3 echo echo "── 隧道最近 30 分钟事件 ──" reconn=$(journalctl -u lanremote-tunnel --since '30 minutes ago' --no-pager 2>/dev/null | grep -c 'Registered tunnel connection') lost=$(journalctl -u lanremote-tunnel --since '30 minutes ago' --no-pager 2>/dev/null | grep -c 'Lost connection') iot=$(journalctl -u lanremote-tunnel --since '30 minutes ago' --no-pager 2>/dev/null | grep -c 'i/o timeout') echo " 重连 $reconn 次 · 掉线 $lost 次 · i/o timeout $iot 次" echo echo "── 最近的掉线/重连明细 ──" journalctl -u lanremote-tunnel --since '30 minutes ago' --no-pager 2>/dev/null \ | grep -E 'Registered tunnel connection|Lost connection' | tail -8 | sed 's/^/ /' echo echo "── watchdog 最近 12 行 ──" tail -12 /root/lanremote-relay/watchdog.log 2>/dev/null | sed 's/^/ /' echo echo "── 隧道连接数和落点 ──" curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null \ | grep -E '^cloudflared_tunnel_ha_connections|server_locations.*} 1' | sed 's/^/ /' echo echo "── 公网现在通不通(10 次快速探测)──" ok=0 for i in $(seq 1 10); do c=$(curl -s -o /dev/null -w '%{http_code}' --max-time 15 \ -H 'User-Agent: LanRemote/1.8.1' https://relay.xxmxxs.top/v1/health) [ "$c" = "200" ] && ok=$((ok+1)) printf " %d: %s\n" "$i" "$c" sleep 1 done echo " 可用 $ok/10"