feat: Graceful shutdown (10s);backup 格式兼容 .dump.gz;容器连接监控
Some checks failed
Deploy Backend / deploy (push) Has been cancelled

This commit is contained in:
2026-07-15 11:05:11 +08:00
parent ae64614342
commit 917d69c171
2 changed files with 4 additions and 2 deletions

View File

@@ -279,8 +279,8 @@ backup_database() {
}
cleanup_old_db_backups() {
local keep="${1:-1}"
local to_del; to_del=$(remote "ls -t ${REMOTE_DIR}/backups/${DB_NAME}_*.dump 2>/dev/null | tail -n +$((keep+1))" || echo "")
local keep="${1:-7}"
local to_del; to_del=$(remote "ls -t ${REMOTE_DIR}/backups/${DB_NAME}_*.dump* 2>/dev/null | tail -n +$((keep+1))" || echo "")
[ -z "$to_del" ] && return 0
log_step "清理旧数据库备份(保留 ${keep} 个)..."
echo "$to_del" | while read -r f; do [ -n "$f" ] && remote "rm -f '${f}'" 2>/dev/null && echo " 删除: $(basename "$f")" || true; done