#! /bin/sh # de.oddb.org ODDB_HOME='/var/www' yyyy=`date -d '1 days ago' +"%Y"` mm=`date -d '1 days ago' +"%m"` dd=`date -d '1 days ago' +"%d"` m=(dummy January February March April May June July August September October November December) #echo ${m[01]} nm=`expr $mm + 0` #echo ${m[nm]} #sudo -u postgres dropdb oddb.org.ruby193 sudo -u postgres dropdb oddb #sudo -u postgres createdb -E UTF8 -T template0 oddb.org.ruby193 sudo -u postgres createdb -E UTF8 -T template0 oddb #cd $ODDB_HOME/oddb.org cd $ODDB_HOME/de.oddb.org mkdir data/sql #scp ywesee@thinpower.ywesee.com:/var/backup/thinpower/db/postgresql/${m[nm]}-$yyyy/$yyyy-$mm-$dd/22\:00-postgresql_database-oddb_dot_org-backup.gz data/sql/oddb.org.$yyyy$mm$dd.sql.gz scp ywesee@thinpower.ywesee.com:/var/backup/thinpower/db/postgresql/${m[nm]}-$yyyy/$yyyy-$mm-$dd/22\:00-postgresql_database-oddb-backup.gz data/sql/oddb.$yyyy$mm$dd.sql.gz cd data/sql #zcat oddb.org.ruby193.$yyyy$mm$dd.sql.gz | psql -U postgres oddb.org.ruby193 zcat oddb.$yyyy$mm$dd.sql.gz | psql -U postgres oddb