#!/bin/bash # 重启后全面体检 set -u echo "════════ 开机信息 ════════" uptime -p | sed 's/^/ /' systemd-analyze 2>/dev/null | sed 's/^/ /' echo echo "════════ 服务 ════════" for s in lanremote-relay lanremote-tunnel lanremote-nettune lanremote-watchdog.timer NetworkManager-wait-online; do printf " %-30s %-10s %s\n" "$s" "$(systemctl is-active $s 2>&1)" "$(systemctl is-enabled $s 2>&1)" done echo " ---" echo " systemd-networkd-wait-online: $(systemctl is-enabled systemd-networkd-wait-online 2>&1) (应该是 masked)" echo echo "════════ 网络调优是否持久化 ════════" for k in tcp_keepalive_time tcp_keepalive_intvl tcp_keepalive_probes tcp_mtu_probing tcp_slow_start_after_idle tcp_congestion_control; do printf " %-32s = %s\n" "$k" "$(sysctl -n net.ipv4.$k 2>/dev/null || echo '?')" done echo " MSS 钳制: $(iptables -t mangle -S 2>/dev/null | grep -c TCPMSS) 条" echo echo "════════ 隧道 ════════" echo " 连接数: $(curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')" echo " 落点:" grep -E 'Registered tunnel connection' /root/lanremote-relay/tunnel.log 2>/dev/null | tail -4 \ | grep -oE 'location=[a-z0-9]+ protocol=[a-z0-9]+' | sed 's/^/ /' echo " 参数:" grep -oE '\-\-protocol [a-z0-9]+|--ha-connections [0-9]+' /etc/systemd/system/lanremote-tunnel.service | sed 's/^/ /' echo echo "════════ 本机中转 ════════" echo " HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 8 http://127.0.0.1:8080/v1/health)" echo echo "════════ 公网 12 次 ════════" ok=0 for i in $(seq 1 12); do c=$(curl -s -o /dev/null -w '%{http_code}' --max-time 15 \ -H 'User-Agent: LanRemote/1.4.0' https://relay.xxmxxs.top/v1/health) [ "$c" = "200" ] && ok=$((ok+1)) printf " %2d: %s\n" "$i" "$c" sleep 1 done echo " 可用 $ok/12" echo echo "════════ 官网 + 管理页 ════════" echo " 官网 HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 https://relay.xxmxxs.top/)" echo " 管理页 HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 https://relay.xxmxxs.top/zhongzhuanzhan)" echo " 截图 HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 https://relay.xxmxxs.top/shot/pc-main.png)" echo echo "════════ watchdog 日志 ════════" tail -6 /root/lanremote-relay/watchdog.log 2>/dev/null | sed 's/^/ /'