Skip to content

Commit

Permalink
Merge pull request Katello#6 from weissjeffm/master
Browse files Browse the repository at this point in the history
New restore.sh script to restore a backup of katello's data
  • Loading branch information
jsomara committed Apr 16, 2012
2 parents 0b90c1e + 5e76031 commit 084e329
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/script/restore.sh
@@ -0,0 +1,38 @@
#!/bin/bash -e
BDIR=$(readlink -f "$1")
cd $BDIR

#shut everything down
service katello stop
service katello-jobs stop
service pulp-server stop
service tomcat6 stop
service postgresql stop
service elasticsearch stop

#extract files
tar --selinux -xzvf config_files.tar.gz -C /
tar --selinux -xzvf elastic_data.tar.gz -C /
tar --selinux -xvf pulp_data.tar -C /

#restore dbs
service postgresql start
sleep 5
dropdb -U postgres katelloschema
dropdb -U postgres candlepin

pg_restore -U postgres -C -d postgres $BDIR/katello.dump
pg_restore -U postgres -C -d postgres $BDIR/candlepin.dump

service mongod start
sleep 5
echo 'db.dropDatabase();' | mongo pulp_database

mongorestore --host localhost mongo_dump/pulp_database/

service postgresql start
service tomcat6 start
service pulp-server start
service elasticsearch start
service katello-jobs start
service katello start

0 comments on commit 084e329

Please sign in to comment.