From 28948f6c51cdb84003e8274a8307661984889338 Mon Sep 17 00:00:00 2001 From: selfrelease Date: Fri, 4 Sep 2026 22:32:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20backup.sh=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=94=B9=E4=B8=BAbossai@ubuntu,=E7=94=A8unix?= =?UTF-8?q?=20socket=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backup.sh b/backup.sh index ff582c8..42ab58c 100755 --- a/backup.sh +++ b/backup.sh @@ -16,9 +16,9 @@ set -euo pipefail BACKUP_DIR="${1:-./backups}" GPG_RECIPIENT="${2:-}" -DB_NAME="${DB_NAME:-mcp}" -DB_USER="${DB_USER:-postgres}" -DB_HOST="${DB_HOST:-localhost}" +DB_NAME="${DB_NAME:-bossai}" +DB_USER="${DB_USER:-ubuntu}" +DB_HOST="${DB_HOST:-/var/run/postgresql}" DB_PORT="${DB_PORT:-5432}" RETENTION_DAYS=7 @@ -30,7 +30,7 @@ COMPRESSED="$DUMP_FILE.gz" echo "[$(date)] 开始备份: $DB_NAME@$DB_HOST:$DB_PORT" -# 1. pg_dump 导出 +# 1. pg_dump 导出(通过 unix socket peer auth,无需密码) if pg_dump -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -f "$DUMP_FILE"; then echo "[$(date)] 导出成功: $DUMP_FILE" else @@ -71,6 +71,7 @@ cat <