Files
crypto_monitor/deploy/pm2_start_all.sh
T
dekun 4923b32bbe feat: 新增 Plan B 整目录重装脚本,不影响 setup_env 一键安装
添加 deploy/reinstall.sh 备份 env、克隆、调 setup_env、恢复配置并 PM2 启动;
附带 pm2_start_all.sh 与 hub_settings 清理工具。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 22:07:59 +08:00

42 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 按推荐顺序启动三所 Flask + 中控 hub/三 agentPM2)。
# 用法(仓库根或任意目录):
# bash deploy/pm2_start_all.sh
#
# 与 deploy/setup_env.sh 独立:setup_env 只建 venv;本脚本负责 PM2 启动。
set -e
set -u
if [ -n "${BASH_VERSION:-}" ]; then
set -o pipefail
fi
DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)"
start_one() {
local dir_name="$1"
local proj="${REPO_ROOT}/${dir_name}"
local eco="${proj}/ecosystem.config.cjs"
if [[ ! -f "${eco}" ]]; then
echo "skip (no ecosystem): ${dir_name}" >&2
return 0
fi
echo "==> pm2 start ${dir_name}"
(cd "${proj}" && pm2 start ecosystem.config.cjs)
}
if ! command -v pm2 >/dev/null 2>&1; then
echo "未找到 pm2,请先安装 Node.js 与 pm2(见 docs/ubuntu-server.md" >&2
exit 1
fi
start_one crypto_monitor_binance
start_one crypto_monitor_gate
start_one crypto_monitor_okx
start_one manual_trading_hub
pm2 save 2>/dev/null || true
echo ""
echo "PM2 进程:"
pm2 list