postgresql_backup. Configurable ZSTD and GZip levels.

This commit is contained in:
Alexey Skobkin 2024-11-06 20:04:19 +00:00
parent a2f25f51a8
commit 34c2a222a3

View file

@ -62,9 +62,9 @@ for PREFIX in $DATABASE_PREFIXES; do
# Perform the backup based on the specified format # Perform the backup based on the specified format
if [[ "$DUMP_FORMAT" == "custom" ]]; then 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 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 else
echo "Invalid DUMP_FORMAT for $PREFIX: $DUMP_FORMAT. Skipping..." echo "Invalid DUMP_FORMAT for $PREFIX: $DUMP_FORMAT. Skipping..."
continue continue