feat: 增加生产数据库每日备份与状态门禁
This commit is contained in:
1 parent
072a1037ac
commit
015947f8fb
9 files changed
+384
-55
No files matched your search
@@ -40,6 +40,8 @@ export function buildRemoteStatusScript({ deployRoot: rootPath = deployRoot } =
|
||||
'printf "database="; docker inspect -f "{{.State.Status}}" personal-brand-postgres-1',
|
||||
'printf "backups="; find "$DEPLOY_ROOT/shared/backups" -maxdepth 1 -name "*.dump" | wc -l',
|
||||
'printf "latest-backup="; newest=$(find "$DEPLOY_ROOT/shared/backups" -maxdepth 1 -type f -name "*.dump" -printf "%T@ %p\\n" | sort -nr | head -1 | cut -d" " -f2-); test -n "$newest"; stat -c "%y %s bytes" "$newest"; docker exec -i personal-brand-postgres-1 pg_restore -l < "$newest" >/dev/null; echo readable',
|
||||
'printf "backup-timer="; systemctl --user is-active personal-brand-backup.timer',
|
||||
'printf "backup-age-hours="; newest=$(find "$DEPLOY_ROOT/shared/backups" -maxdepth 1 -type f -name "*.dump" -printf "%T@ %p\\n" | sort -nr | head -1 | cut -d" " -f2-); age=$(( ( $(date +%s) - $(stat -c %Y "$newest") ) / 3600 )); echo "$age"; test "$age" -le "${BACKUP_MAX_AGE_HOURS:-36}"',
|
||||
'printf "backup-temp-files="; find "$DEPLOY_ROOT/shared/backups" -maxdepth 1 -type f -name "*.tmp" | wc -l',
|
||||
'printf "disk="; df -h / | awk \'NR==2 {print $5 " used, " $4 " free"}\'',
|
||||
'printf "release-count="; find "$DEPLOY_ROOT/releases" -mindepth 1 -maxdepth 1 -type d | wc -l',
|
||||
|
||||
Reference in new issue
Block a user