From 34c2a222a3dc3c729f388a7cdd9513626979c2ce Mon Sep 17 00:00:00 2001 From: skobkin Date: Wed, 6 Nov 2024 20:04:19 +0000 Subject: [PATCH] postgresql_backup. Configurable ZSTD and GZip levels. --- postgresql_backup/pg_backup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postgresql_backup/pg_backup.sh b/postgresql_backup/pg_backup.sh index 05e8a48..8c2e6d7 100644 --- a/postgresql_backup/pg_backup.sh +++ b/postgresql_backup/pg_backup.sh @@ -57,14 +57,14 @@ for PREFIX in $DATABASE_PREFIXES; do # Set backup file path within the server-specific directory BACKUP_FILE="$SERVER_DIR/$DB_NAME.$EXTENSION" - + echo "Dumping '$DB_NAME' on $HOST:$PORT to $BACKUP_FILE" # Perform the backup based on the specified format if [[ "$DUMP_FORMAT" == "custom" ]]; then - pg_dump -h "$HOST" -p "$PORT" -U "$USER" -Fc --compress="zstd:21" "$DB_NAME" -f "$BACKUP_FILE" + pg_dump -h "$HOST" -p "$PORT" -U "$USER" -Fc --compress="zstd:$ZSTD_LEVEL" "$DB_NAME" -f "$BACKUP_FILE" elif [[ "$DUMP_FORMAT" == "sql" ]]; then - pg_dump -h "$HOST" -p "$PORT" -U "$USER" "$DB_NAME" | gzip -9 > "$BACKUP_FILE" + pg_dump -h "$HOST" -p "$PORT" -U "$USER" "$DB_NAME" | gzip -$GZIP_LEVEL > "$BACKUP_FILE" else echo "Invalid DUMP_FORMAT for $PREFIX: $DUMP_FORMAT. Skipping..." continue