#!/bin/bash # 收尾:停掉 A/B 对照脚本,确认隧道配置是最终值 set -u echo " ── 1. 停掉对照脚本 ──" pkill -f 'rpab.sh' 2>/dev/null && echo " 已停 rpab.sh" || echo " (本来就没在跑)" pkill -f 'rp_long2h.sh' 2>/dev/null && echo " 已停 rp_long2h.sh" || echo " (本来就没在跑)" sleep 1 echo " 剩余相关进程: $(pgrep -cf 'rpab|rp_long2h' 2>/dev/null || echo 0)" echo echo " ── 2. 确认隧道配置是最终采用的(quic8 + h2 2)──" for s in lanremote-tunnel lanremote-tunnel-h2; do cfg=$(grep -oE -- '--protocol [a-z0-9]+|--ha-connections [0-9]+' \ "/etc/systemd/system/$s.service" 2>/dev/null | tr '\n' ' ') printf " %-24s %-40s %s\n" "$s" "$cfg" "$(systemctl is-active $s)" done if grep -q 'ha-connections 4' /etc/systemd/system/lanremote-tunnel-h2.service 2>/dev/null; then echo " ⚠ B 组配置还挂着(h2 4 条),改回 2 条" sed -i 's/--ha-connections 4/--ha-connections 2/' /etc/systemd/system/lanremote-tunnel-h2.service systemctl daemon-reload systemctl restart lanremote-tunnel-h2 sleep 6 echo " 改完: $(grep -oE -- '--ha-connections [0-9]+' /etc/systemd/system/lanremote-tunnel-h2.service)" else echo " ✓ 已经是最终配置" fi echo echo " ── 3. 连上几条 ──" 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 " ── 4. 公网自检 ──" 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 " ── 5. 保留的数据文件(不删,以后还能看)──" ls -la --time-style=+%H:%M /root/ab_A_health.tsv /root/ab_A_conns.tsv /root/ab_A_res.tsv 2>/dev/null | awk '{printf " %s %s %s\n", $7, $6, $5}' || echo " (没有)" echo " A 组样本: $(wc -l < /root/ab_A_health.tsv 2>/dev/null || echo 0)"