#!/bin/sh # 新服务器修复: 恢复"已停止"节点 + 升级keepalive(防批量导入竞态) echo "== 1. 升级 keepalive(防再犯) ==" curl -s -o /opt/ippanel/keepalive.sh http://sky24.852151.xyz/keepalive_patched.sh chmod +x /opt/ippanel/keepalive.sh md5sum /opt/ippanel/keepalive.sh echo "== 2. 补建缺失的 hysteria 配置 ==" python3 - <<'EOF' import json, os BASE="/opt/ippanel" data=json.load(open(f"{BASE}/sessions.json")) ports={str(s['port']) for s in data} yamls={f.replace('h2_','').replace('.yaml','') for f in os.listdir(BASE) if f.startswith('h2_') and f.endswith('.yaml')} missing=sorted(ports-yamls, key=int) print("会话: %d | yaml: %d | 缺失: %d" % (len(ports), len(yamls), len(missing))) made=0 for s in data: p=s['port'] y=f"{BASE}/h2_{p}.yaml" if os.path.exists(y): continue pw=f"jpchain{p}" cfg=f"""listen: :{p} tls: cert: {BASE}/certs/h2.crt key: {BASE}/certs/h2.key auth: type: password password: "{pw}" outbounds: - name: out type: socks5 socks5: addr: "{s['host']}:{s['rport']}" username: "{s['user']}" password: "{s['pwd']}" """ open(y,"w").write(cfg) made+=1 print("补建: %d 个" % made) EOF echo "== 3. 起进程 ==" sh /opt/ippanel/keepalive.sh sleep 8 echo "== 4. 结果 ==" echo "hysteria 进程数: $(pgrep -fc 'hysteria server')" echo "应等于会话数。面板 Ctrl+F5 刷新看状态。"