Files
stock/stock-html/deploy/sync-to-new-server.sh
T
freedakgmail 9c7d7abdd4 Initial commit
2026-07-17 18:49:35 +08:00

37 lines
975 B
Bash
Executable File

#!/bin/bash
# 快速同步代码到新服务器并重启 - 152.136.182.184 (stock.allbyai.cn)
# 用于日常代码更新
set -e
NEW_SERVER="ubuntu@152.136.182.184"
APP_DIR="/opt/stock-app"
LOCAL_DIR="/Users/freedak/Documents/go-new/stock/stock-html"
echo "同步代码到 stock.allbyai.cn (152.136.182.184)..."
rsync -avz ${LOCAL_DIR}/ ${NEW_SERVER}:${APP_DIR}/ \
--exclude='.git' \
--exclude='venv' \
--exclude='__pycache__' \
--exclude='stock_data_cache' \
--exclude='*.pyc' \
--exclude='.DS_Store' \
--exclude='stock_names.json' \
--exclude='alerts_cache.json' \
--exclude='trades.json' \
--exclude='watchlist.json' \
--exclude='*.log' \
--exclude='.playwright-mcp' \
--exclude='/app.js' \
--exclude='/index.html' \
--exclude='/main.css' \
--exclude='/css' \
--exclude='/js' \
--exclude='/.windsurfrules'
ssh ${NEW_SERVER} "systemctl restart stock-app && echo '✅ 服务已重启'"
echo ""
echo "访问: http://stock.allbyai.cn"