Files
eth_hedge_sim/deploy/lib/update.sh
T
dekun 4d331da962 Detect Python/Node/PM2 on deploy (install only if missing); uninstall removes /opt/eth_hedge_sim.
Keep .env and DB backup under /root/backups before deleting the install directory.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 23:08:51 +08:00

32 lines
835 B
Bash
Executable File
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
# deploy/lib/update.sh — 更新(仅 git pull,禁止 scp
set -e
set -u
if [ -n "${BASH_VERSION:-}" ]; then
set -o pipefail
fi
LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=common.sh
source "${LIB_DIR}/common.sh"
main_update() {
require_root
if ! REPO_ROOT="$(resolve_repo_root)"; then
die "未找到安装目录 ${INSTALL_ROOT},请先执行「1) 一键部署」"
fi
if ! repo_ready "${REPO_ROOT}"; then
die "安装不完整,请先执行「1) 一键部署」"
fi
step "更新 — 环境检测 (缺则装,有则跳过)"
ensure_system_deps
step "更新 比特骆驼自动化对冲系统 (git pull + 构建 + pm2 reload)"
bash "${REPO_ROOT}/deploy/pull_and_restart.sh"
verify_health || true
echo ""
log "更新完成"
}
main_update "$@"