Add system-level hs_* temp dir cleanup at end of sync

This commit is contained in:
2026-04-20 18:55:25 +08:00
parent 4ca7c2da6c
commit 12e7133e34

15
sync.sh
View File

@@ -259,4 +259,19 @@ if [ -d "$SYNC_DIR/skills" ]; then
cp -rn "$SYNC_DIR/skills/"* "$HERMES_HOME/skills/" 2>/dev/null || true
fi
# ── Cleanup: Remove stale hermes-sync temp dirs from system tmp ─────────────
# (in case previous runs were interrupted and finally block didn't fire)
python3 -c "
import shutil, glob, os
tmp = os.environ.get('TMPDIR', '/tmp')
for p in glob.glob(os.path.join(tmp, 'hs_exp_*')) + \
glob.glob(os.path.join(tmp, 'hs_merge_*')) + \
glob.glob(os.path.join(tmp, 'hs_rest_*')):
try:
shutil.rmtree(p)
print(f'Cleaned: {p}')
except Exception:
pass
" 2>/dev/null || true
echo "[$(date '+%H:%M:%S')] Done"