#!/bin/bash # 看 relay-stability 在设备上跑到哪了 set -u echo " ── 它起的进程 ──" pgrep -af 'rp_|long2h|ab_long|collapse' 2>/dev/null | head -6 | sed 's/^/ /' || echo " (没有)" echo echo " ── /root 下它最近写的文件 ──" ls -la --time-style=+%H:%M:%S /root/rp_* /root/*.tsv /root/*.txt /root/*.out 2>/dev/null \ | sort -k6 | tail -12 | sed 's/^/ /' echo echo " ── 那个 2 小时长测的输出 ──" if [ -f /root/long2h_health.tsv ]; then echo " 样本数: $(wc -l < /root/long2h_health.tsv)" echo " 最后 3 行:" tail -3 /root/long2h_health.tsv | sed 's/^/ /' fi echo echo " ── 配比对照有没有开始(看隧道配置变没变)──" for s in lanremote-tunnel lanremote-tunnel-h2; do printf " %-24s %s\n" "$s" \ "$(grep -oE -- '--protocol [a-z0-9]+|--ha-connections [0-9]+' /etc/systemd/system/$s.service 2>/dev/null | tr '\n' ' ')" done for p in 20241 20242; do n=$(curl -s --max-time 4 "http://127.0.0.1:$p/metrics" 2>/dev/null \ | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}') printf " 端口 %s -> %s 条\n" "$p" "${n:-读不到}" done echo echo " ── 公网自检 ──" curl -s --max-time 20 -o /dev/null -w ' HTTP %{http_code} %{time_total}s\n' \ -H 'User-Agent: LanRemote/1.8.2' https://relay.xxmxxs.top/v1/health echo echo " ── 设备当前时间 ──" date '+ %H:%M:%S'