migrate 第5步:pgrep 自匹配過濾(ssh 包裝行本身含搜尋字串,搶走 head -1)
This commit is contained in:
parent
454cd97082
commit
2b31edd273
|
|
@ -134,7 +134,7 @@ fi
|
||||||
# ---------- 5. 大脑改接新 relay ----------
|
# ---------- 5. 大脑改接新 relay ----------
|
||||||
say "5/7 大腦那台的 AnyBot 改接新帳號伺服器"
|
say "5/7 大腦那台的 AnyBot 改接新帳號伺服器"
|
||||||
# 只认带绝对路径的宿主进程行(Docker 容器里的 anybot 在主机上喊不到)。
|
# 只认带绝对路径的宿主进程行(Docker 容器里的 anybot 在主机上喊不到)。
|
||||||
SERVE_LINE=$(ssh -o BatchMode=yes "$SSH_TARGET" "pgrep -af 'anybot --serve' | grep '/anybot --serve' | head -1")
|
SERVE_LINE=$(ssh -o BatchMode=yes "$SSH_TARGET" "pgrep -af 'anybot --serve' | grep '/anybot --serve' | grep -v pgrep | head -1")
|
||||||
BIN=$(printf '%s' "$SERVE_LINE" | grep -o '/[^ ]*/anybot' | head -1)
|
BIN=$(printf '%s' "$SERVE_LINE" | grep -o '/[^ ]*/anybot' | head -1)
|
||||||
DDIR=$(printf '%s' "$SERVE_LINE" | grep -o -- '--data-dir [^ ]*' | cut -d' ' -f2)
|
DDIR=$(printf '%s' "$SERVE_LINE" | grep -o -- '--data-dir [^ ]*' | cut -d' ' -f2)
|
||||||
if [ -z "$BIN" ]; then
|
if [ -z "$BIN" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue