Created
June 29, 2015 12:41
-
-
Save cnorthwood/2e9e2f8cd1def6dcd182 to your computer and use it in GitHub Desktop.
Go restore script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
most_recent=`s3cmd ls $S3_BUCKET | cut -d/ -f4 | sort | tail -1` | |
base=`mktemp -d` | |
function restore_from_zip() { | |
type=$1 | |
dest=$2 | |
unzip $type.zip -d $type | |
rm -rf $dest | |
mv $type/ $dest/ | |
chown -R go:go $dest/ | |
} | |
s3cmd get -r $S3_BUCKET/$most_recent/ $base | |
cd $base | |
restore_from_zip db /var/lib/go-server/db/h2db | |
restore_from_zip config-dir /etc/go | |
restore_from_zip config-repo /var/lib/go-server/db/config.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment