diff --git a/scripts/kanban_update.py b/scripts/kanban_update.py index 0566cac..cd6ed22 100644 --- a/scripts/kanban_update.py +++ b/scripts/kanban_update.py @@ -24,7 +24,9 @@ """ import json, pathlib, datetime, sys, subprocess, logging, os, re -_BASE = pathlib.Path(__file__).resolve().parent.parent +# 优先使用环境变量 EDICT_HOME,兜底才用脚本相对路径 +# 这样脚本被 sync 到各 workspace 后仍能正确写入中央数据库 +_BASE = pathlib.Path(os.environ['EDICT_HOME']) if 'EDICT_HOME' in os.environ else pathlib.Path(__file__).resolve().parent.parent TASKS_FILE = _BASE / 'data' / 'tasks_source.json' REFRESH_SCRIPT = _BASE / 'scripts' / 'refresh_live_data.py' diff --git a/scripts/run_loop.sh b/scripts/run_loop.sh index 53eef5c..53b3c8f 100755 --- a/scripts/run_loop.sh +++ b/scripts/run_loop.sh @@ -5,6 +5,8 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# EDICT_HOME 指向中央仓库根目录,供各 workspace 里的 kanban_update.py 定位中央数据库 +export EDICT_HOME="$(dirname "$SCRIPT_DIR")" INTERVAL="${1:-15}" LOG="/tmp/sansheng_liubu_refresh.log" PIDFILE="/tmp/sansheng_liubu_refresh.pid"