Skip to content

Instantly share code, notes, and snippets.

@cnorthwood
Created June 29, 2015 12:41
Show Gist options
  • Save cnorthwood/2e9e2f8cd1def6dcd182 to your computer and use it in GitHub Desktop.
Save cnorthwood/2e9e2f8cd1def6dcd182 to your computer and use it in GitHub Desktop.
Go restore script
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