Merge pull request #638 from jangeador/db-gzip

makes the database backups compressed. restores compressed backups
This commit is contained in:
Jannis Gebauer 2016-06-24 22:40:43 +02:00 committed by GitHub
commit 1d8bfe5554
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