Skip to content

Instantly share code, notes, and snippets.

@rtekie
Created July 10, 2011 17:21
Show Gist options
  • Save rtekie/1074723 to your computer and use it in GitHub Desktop.
Save rtekie/1074723 to your computer and use it in GitHub Desktop.
Heroku database backup to development system - add to crontab
#!/bin/bash
echo "Backup started" `date`
APPLICATION_DIR=YOUR_APP_DIRECTORY_GOES_HERE
BACKUP_DIR=YOUR_BACKUP_DIRECTORY_GOES_HERE
cd ${APPLICATION_DIR}
heroku pgbackups:capture --expire
URL=`heroku pgbackups:url`
URL=${URL//\"/}
echo $URL
curl -o $BACKUP_DIR`date +"db_dump_%Y%m%d%H"` ${URL}
echo "Backup completed" `date`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment