Files
claude_dev 4876727289
CI/CD / test (push) Successful in 11s
CI/CD / nas-deploy (push) Successful in 23s
CI/CD / nas-verify (push) Successful in 3s
fix(nas_sync): sync_valuation_daily 改scp-r(单tar跨公网broken pipe)
单tar 1.1GB scp跨公网broken pipe(连接断retry难救);改scp-r多文件独立传
(sync_parquet.sh验证6.24G鲁棒)。实测valuation+financial_abstract DONE,
8-1同步5535x2文件。踩坑:nohup &在tee命令里干扰stdin致部署空,分步tee。
2026-08-01 02:04:19 +08:00

38 lines
1.4 KiB
Bash
Raw Permalink 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.
#!/bin/bash
# NAS 端:每日同步 VPS valuation + financial_abstractak-eod 每日 --force 全量重写)。
#
# 设计迭代(2026-07-31 实测):
# - ak-eod 每日 --force 重写 valuation/financial_abstract(估值随股价每日变)
# - bsdtar --newer 慢盘 stat 不可行;python tarfile 打包 9.5s/1.1GB OK
# - 但 scp 单 tar 1.1GB 跨公网 broken pipe(连接断全丢,retry 难救)
# - 改 scp -r 目录:多文件独立传,单文件失败不牵连(sync_parquet.sh 验证 6.24G 鲁棒)
#
# 调度:ak-eod 19:00 跑完(~21:30)后延迟跑。
set -u
KEY=/var/services/homes/admin/.ssh/id_ed25519_nas
VPS=Administrator@49.232.102.198
ROOT=/volume1/stock/sanguo_vnpy_v2
DATA=$ROOT/data
LOG=$ROOT/data_backup/valuation_daily.log
DIRS="valuation financial_abstract"
TS=$(date '+%F %T')
echo "=== $TS valuation daily (scp -r) ===" >> "$LOG"
for d in $DIRS; do
OK=0
for attempt in 1 2 3; do
if scp -r -i "$KEY" -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o ServerAliveCountMax=20 \
"$VPS:C:/sanguo_vnpy_v2/data/static/$d" "$DATA/static/" >> "$LOG" 2>&1; then
OK=1
break
fi
echo "[$(date '+%T')] $d scp attempt $attempt fail, retry..." >> "$LOG"
sleep 5
done
echo "[$(date '+%T')] $d $( [ "$OK" = 1 ] && echo OK || echo FAIL )" >> "$LOG"
done
echo "[$(date '+%T')] valuation daily DONE" >> "$LOG"