- mo_data.py 提升为根目录canonical(含tag修复), deploy/profile-scripts/ scripts/ profile脚本目录 全部硬链到根 - mofin_db.py 同理(含strategy_history/tag迁移), 四处硬链统一 - sync_profile_scripts.sh 增加库文件链接步骤, merge后自动恢复 - 根因: deploy/profile-scripts/mofin_db.py 是7-20陈旧副本(无snapshot), profile脚本目录mo_data.py无tag——hygiene分叉副本检查正确报警
29 lines
1.2 KiB
Bash
Executable File
29 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
||
# sync_profile_scripts.sh — 把 deploy/profile-scripts 全部硬链接到 profile scripts 目录
|
||
# 每次部署(scp/git)后必须跑:scp替换文件会破坏硬链接(inode变更),导致cron跑旧版本。
|
||
set -e
|
||
SRC="/home/hmo/MoFin/deploy/profile-scripts"
|
||
DST="/home/hmo/.hermes/profiles/position-analyst/scripts"
|
||
count=0
|
||
for f in "$SRC"/*.py; do
|
||
name=$(basename "$f")
|
||
ln -f "$f" "$DST/$name"
|
||
count=$((count+1))
|
||
done
|
||
ln -f "$SRC/sync_profile_scripts.sh" "$DST/sync_profile_scripts.sh" 2>/dev/null || true
|
||
|
||
# ── 库文件 SSOT:canonical 在 MoFin 根目录,其他位置只许硬链(红线#6)──
|
||
# git checkout/merge 会重写文件破坏硬链,这里强制恢复
|
||
ROOT="/home/hmo/MoFin"
|
||
for lib in mofin_db.py mo_data.py; do
|
||
if [ -f "$ROOT/$lib" ]; then
|
||
ln -f "$ROOT/$lib" "$ROOT/deploy/profile-scripts/$lib" 2>/dev/null || true
|
||
ln -f "$ROOT/$lib" "$ROOT/scripts/$lib" 2>/dev/null || true
|
||
ln -f "$ROOT/$lib" "/home/hmo/web-dashboard/$lib" 2>/dev/null || true
|
||
ln -f "$ROOT/$lib" "$DST/$lib" 2>/dev/null || true
|
||
fi
|
||
done
|
||
|
||
echo "synced $count scripts (hardlink)"
|
||
mkdir -p /home/hmo/MoFin/gateway/logs
|
||
echo "$(date '+%F %T') synced $count scripts" >> /home/hmo/MoFin/gateway/logs/link_sync.log |