From 9499428995a69ca97c981a847627537b137533f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=8C?= <259278618@qq.com> Date: Thu, 25 Jun 2026 09:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/postgres-backup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/postgres-backup.sh b/scripts/postgres-backup.sh index f70a04d..3f3d7a8 100755 --- a/scripts/postgres-backup.sh +++ b/scripts/postgres-backup.sh @@ -5,6 +5,9 @@ CREDENTIALS="-h ${PGHOST:-postgres} -U ${PGUSER:-postgres}" BACKUP_DIR=${BACKUP_DIR:-/backup} RETENTION_DAYS=${RETENTION_DAYS:-7} +# 自动创建备份目录 +mkdir -p "$BACKUP_DIR" + backup() { local filename="backup_$(date +%Y%m%d_%H%M%S).sql.gz" echo "[$(date +%Y-%m-%d\ %H:%M:%S)] Starting backup: $filename"