Skip to content

Instantly share code, notes, and snippets.

@gbenedict
Created September 16, 2009 15:41
Show Gist options
  • Save gbenedict/188110 to your computer and use it in GitHub Desktop.
Save gbenedict/188110 to your computer and use it in GitHub Desktop.
# First, you need a bundle captured if you haven't already.
heroku bundles:capture
# Second, you need to destroy the old one to create a new one.
# Then you can download the backup.
heroku bundles:destroy `heroku bundles | awk '{print $1}'`
heroku bundles:capture
# give it 1 minute to create the file
sleep 60
heroku bundles:download
# Here is a more complex example grabbing the app name.
heroku info | grep '===' | awk '{print $2}'
# You can then pass it into the bundles command
heroku bundles:destroy --app `heroku info | grep '===' | awk '{print $2}'` `heroku bundles | awk '{print $1}'`
heroku bundles:capture --app `heroku info | grep '===' | awk '{print $2}'`
# give it 1 minute to create the file
sleep 60
heroku bundles:download --app `heroku info | grep '===' | awk '{print $2}'`
# You can also use it to move the file outside your git repo and
# rename the backup file to the bundle date.
mv `heroku info | grep '===' | awk '{print $2}'`.tar.gz /path/to/backup/
mv /path/to/backup/`heroku info | grep '===' | awk '{print $2}'`.tar.gz /path/to/backup/`heroku bundles | awk '{print $1}'`.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment