Skip to content

Instantly share code, notes, and snippets.

@Saka7
Created May 20, 2020 07:18
Show Gist options
  • Save Saka7/8674e300c62c6a3eb6563577bc2b6f14 to your computer and use it in GitHub Desktop.
Save Saka7/8674e300c62c6a3eb6563577bc2b6f14 to your computer and use it in GitHub Desktop.
Create gzip-ed dump of psql database
DB_HOST=0.0.0.0
DB_PORT=5432
DB_USER=postgres
DB_NAME=postgres
DB_SCHEMA=public
BACKUP_FILENAME=$DB_SCHEMA
# File
pg_dump -v -h $DB_HOST -U $DB_USER -d $DB_NAME -W -n $DB_SCHEMA -F c -f $BACKUP_FILENAME.tar.gz
# Stream
pg_dump -h $DB_HOST -U $DB_USER -d $DB_NAME -W -n $DB_SCHEMA -F c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment