Stop uninstall from killing unrelated PM2 processes on the server.

Only stop and delete crypto_monitor app names (plus legacy aliases) instead of pm2 stop/delete all.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-12 12:56:08 +08:00
parent 337a6bc54f
commit 8e492987ec
3 changed files with 60 additions and 11 deletions
+9 -3
View File
@@ -26,6 +26,8 @@ fi
DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_SOURCE="${DEPLOY_DIR}/reinstall.sh"
REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)"
# shellcheck source=lib/common.sh
source "${DEPLOY_DIR}/lib/common.sh"
INSTALL_ROOT="${INSTALL_ROOT:-/opt/crypto_monitor}"
GIT_URL="${GIT_URL:-https://git.bz121.com/dekun/crypto_monitor.git}"
@@ -230,10 +232,14 @@ backup_configs "${SRC_ROOT}" "${BACKUP_DIR}"
# --- 2. 停 PM2 ---
step "停止并清空 PM2"
step "停止并移除本项目 PM2 进程(不影响其它 PM2)"
if command -v pm2 >/dev/null 2>&1; then
run pm2 stop all || true
run pm2 delete all || true
if [[ "${DRY_RUN}" -eq 1 ]]; then
log "[dry-run] pm2 stop/delete 仅: ${PM2_APPS[*]} (及历史别名)"
else
pm2_stop_project_apps
pm2_delete_project_apps
fi
else
log "未安装 pm2,跳过"
fi