migrate 第5步:改用 pgrep -x anybot(依程式名精準比對,grep/pgrep/bash 包装行都不再误中)

This commit is contained in:
王性驊 2026-11-19 17:25:54 +08:00
parent 2b31edd273
commit f3fc047a0e
1 changed files with 1 additions and 1 deletions

View File

@ -134,7 +134,7 @@ fi
# ---------- 5. 大脑改接新 relay ----------
say "5/7 大腦那台的 AnyBot 改接新帳號伺服器"
# 只认带绝对路径的宿主进程行(Docker 容器里的 anybot 在主机上喊不到)。
SERVE_LINE=$(ssh -o BatchMode=yes "$SSH_TARGET" "pgrep -af 'anybot --serve' | grep '/anybot --serve' | grep -v pgrep | head -1")
SERVE_LINE=$(ssh -o BatchMode=yes "$SSH_TARGET" "pgrep -x anybot -a | grep '/anybot --serve' | head -1")
BIN=$(printf '%s' "$SERVE_LINE" | grep -o '/[^ ]*/anybot' | head -1)
DDIR=$(printf '%s' "$SERVE_LINE" | grep -o -- '--data-dir [^ ]*' | cut -d' ' -f2)
if [ -z "$BIN" ]; then