Files
claude_dev 3813d22e2b
CI/CD / test (push) Successful in 8s
CI/CD / nas-deploy (push) Successful in 22s
CI/CD / nas-verify (push) Successful in 4s
fix(nas_sync): sync_parquet.sh 加保活+retry(防6.24G跨公网broken pipe)
scp -r 6.24G/70min跨公网,加ServerAliveInterval=30保活+3次retry兜底broken pipe。
2026-08-01 07:37:31 +08:00

30 lines
1.2 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 parquet(static+valuation) 全量 scp pull(一次性备份,非每日)。
# 脱离 ssh 会话运行(避免 sshd 关会话杀进程组):
# nohup setsid bash sync_parquet.sh </dev/null >/dev/null 2>&1 &
set -u
KEY=/var/services/homes/admin/.ssh/id_ed25519_nas
VPS=Administrator@49.232.102.198
DATA=/volume1/stock/sanguo_vnpy_v2/data
LOG=/volume1/stock/sanguo_vnpy_v2/data_backup/parquet.log
echo "=== parquet scp start $(date) ===" >> "$LOG"
cd "$DATA" || { echo "cd fail" >> "$LOG"; exit 1; }
# scp -r 覆盖式拉取(6.24GB 全量约 70minServerAliveInterval 保活防跨公网 broken pipe + retry 兜底)
SCP_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" \
"$VPS:C:/sanguo_vnpy_v2/data/valuation_baostock" ./ >> "$LOG" 2>&1; then
SCP_OK=1
break
fi
echo "[$(date '+%T')] scp attempt $attempt broken pipe, retry..." >> "$LOG"
sleep 10
done
echo "SCP_RC OK=$SCP_OK $(date)" >> "$LOG"
du -sh "$DATA/static" "$DATA/valuation_baostock" >> "$LOG" 2>&1
echo "PARQUET_DONE $(date)" >> "$LOG"