We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3b7321 commit 1ee649bCopy full SHA for 1ee649b
1 file changed
deploy/upgrade_ldap_prod.sh
@@ -28,7 +28,9 @@ mkdir -p "$BACKUP_DIR"
28
# 备份数据库 (PostgreSQL 逻辑备份,最安全)
29
echo " 正在导出 PostgreSQL 数据库..."
30
if docker compose -f "$COMPOSE_FILE" ps | grep -q "postgres"; then
31
- docker exec sub2api-postgres pg_dump -U postgres sub2api > "$BACKUP_DIR/sub2api_db.sql" || echo "⚠️ 数据库导出可能不完整,请检查运行状态。"
+ DB_USER=$(grep "POSTGRES_USER=" "$ENV_FILE" | cut -d'=' -f2)
32
+ [ -z "$DB_USER" ] && DB_USER="sub2api"
33
+ docker exec sub2api-postgres pg_dump -U "$DB_USER" sub2api > "$BACKUP_DIR/sub2api_db.sql" || echo "⚠️ 数据库导出可能不完整,请检查运行状态。"
34
else
35
echo "⚠️ PostgreSQL 容器未运行,跳过数据库逻辑备份。"
36
fi
0 commit comments