makes the database backups compressed. restores compressed backups

This commit is contained in:
Delio Castillo 2016-06-21 12:29:23 -07:00
parent 308141d5b9
commit 3e866e0aab
2 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ export PGPASSWORD=$POSTGRES_PASSWORD
echo "creating backup"
echo "---------------"
FILENAME=backup_$(date +'%Y_%m_%dT%H_%M_%S').sql
pg_dump -h postgres -U $POSTGRES_USER >> /backups/$FILENAME
FILENAME=backup_$(date +'%Y_%m_%dT%H_%M_%S').sql.gz
pg_dump -h postgres -U $POSTGRES_USER | gzip > /backups/$FILENAME
echo "successfully created backup $FILENAME"

View File

@ -53,4 +53,4 @@ createdb -h postgres -U $POSTGRES_USER $POSTGRES_USER -O $POSTGRES_USER
# restore the database
echo "restoring database $POSTGRES_USER"
psql -h postgres -U $POSTGRES_USER < $BACKUPFILE
gunzip -c $BACKUPFILE | psql -h postgres -U $POSTGRES_USER