Project

General

Profile

« Previous | Next » 

Revision 8939

Added by Jing Tao about 10 years ago

Restore the database for a gzipped sql file.

View differences:

src/scripts/bash/restore-dumped-data-to-pg9.3.sh
12 12
#Check the argument of the script. It only can have one - the metacat backup file name.
13 13

  
14 14
METACAT_BACKUP_DIR=/var/metacat/metacat-backup
15
SQL_FILE=metacat-postgres-backup.sql
15
SQL_FILE=metacat-postgres-backup.gz
16 16
METACAT_BACKUP_FILE_SUFFIX=.tgz
17 17
DB_BASE=/var/lib/postgresql
18 18
OLD_DB_VERSION=8.4
......
78 78
chown -R :$POSTGRES_USER $METACAT_BACKUP_DIR
79 79

  
80 80
echo "restore database"
81
su - $POSTGRES_USER -c "psql -f $METACAT_BACKUP_DIR/$DECOMPRESS_DIR_NAME/$SQL_FILE postgres"
81
su - $POSTGRES_USER -c "gunzip -c $METACAT_BACKUP_DIR/$DECOMPRESS_DIR_NAME/$SQL_FILE | psql postgres"
82 82

  
83 83
echo "end to move database from $OLD_DB_VERSION to $NEW_DB_VERSION at"
84 84
echo `date`

Also available in: Unified diff