Fixed script that imports data from the current live server
This commit is contained in:
parent
dc17ff1e3e
commit
0985ff8f9b
1 changed files with 14 additions and 8 deletions
|
|
@ -1,25 +1,31 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -ex
|
||||||
|
|
||||||
|
#IMAGE_DEST=../public
|
||||||
|
IMAGE_DEST=/local/screenshots
|
||||||
|
#DB_HOST=localhost
|
||||||
|
DB_HOST=torf
|
||||||
|
|
||||||
echo Getting screenshot files
|
echo Getting screenshot files
|
||||||
rsync -v root@screenshots.debian.net:/home/debshots/debshots-screenshots.tar /tmp/
|
rsync -v root@screenshots.debian.net:/home/debshots/debshots-screenshots.tar /tmp
|
||||||
|
|
||||||
echo Getting PostgreSQL dump
|
echo Getting PostgreSQL dump
|
||||||
rsync -v root@screenshots.debian.net:/home/debshots/debshots.sql /tmp
|
rsync -v root@screenshots.debian.net:/home/debshots/debshots.sql /tmp
|
||||||
|
|
||||||
echo Dropping existing database
|
echo Dropping existing database
|
||||||
set +e
|
set +e
|
||||||
psql postgres debshots -c 'drop database debshots'
|
psql -h $DB_HOST postgres debshots -c 'drop database debshots'
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo Creating new database
|
echo Creating new database
|
||||||
psql postgres debshots -c 'create database debshots owner debshots'
|
psql -h $DB_HOST postgres debshots -c 'create database debshots owner debshots'
|
||||||
|
|
||||||
echo Restoring PostgreSQL dump
|
echo Restoring PostgreSQL dump
|
||||||
psql debshots debshots < /tmp/debshots.sql
|
psql -h $DB_HOST debshots debshots < /tmp/debshots.sql
|
||||||
|
|
||||||
echo Unpacking screenshots tarball
|
echo Unpacking screenshots tarball
|
||||||
cd ../public
|
#cd ../public
|
||||||
|
cd $IMAGE_DEST
|
||||||
tar xf /tmp/debshots-screenshots.tar
|
tar xf /tmp/debshots-screenshots.tar
|
||||||
mv public/live/screenshots/approved public/screenshots
|
#mv public/live/screenshots/approved public/screenshots
|
||||||
rm -r public/live
|
#rm -r public/live
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue