整理 NAS 部署目录并归档迁移工具

更新 Compose 和部署更新脚本以使用新的状态、凭据及日历目录布局;新增目录迁移、诊断和历史清理工具及本机演练测试,并记录 NAS 迁移与清理结果。
This commit is contained in:
weiyuqing committed 2026-10-17 22:32:58 +08:00
1 parent 1af63ff83a
commit 6e2a53ad20
14 files changed
+838 -8

No files matched your search

@@ -0,0 +1,17 @@
$ErrorActionPreference = 'Stop'
$script = Join-Path $PSScriptRoot 'cleanup_history.py'
$remote = '/tmp/mi-fitness-cleanup-history-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.py'
& scp $script "fn:$remote"
if ($LASTEXITCODE -ne 0) { throw '清理工具上传失败' }
$expected = (Get-FileHash -LiteralPath $script -Algorithm SHA256).Hash.ToLowerInvariant()
$actual = (& ssh fn "sha256sum '$remote'") -split '\s+'
if ($LASTEXITCODE -ne 0 -or $actual[0] -ne $expected) { throw '传输校验失败' }
Write-Host '仅删除已列出的过时归档。保留运行数据、最近成功迁移记录和当前配置备份,不重启容器。'
& ssh -t fn "sudo python3 '$remote'"
$code = $LASTEXITCODE
$directory = Join-Path $PSScriptRoot '../../artifacts/directory-migration'
New-Item -ItemType Directory -Path $directory -Force | Out-Null
@{exit_code=$code;completed_at=(Get-Date -Format o)} | ConvertTo-Json |
Set-Content -LiteralPath (Join-Path $directory 'cleanup-terminal-result.local.json') -Encoding utf8NoBOM
if ($code -ne 0) { throw '清理未完成,请保留输出。' }
Write-Host '清理完成。'