I’m trying to do something with a Capistrano task that is similar to the heroku db:pull functionality if you are familiar with it.
I have a remote server. On that server I have a bunch of backups in the /path/db_backups/ folder. And in that folder there’s a backup of the database everyday.
All I want to do is
- Download the latest backup on the client machine.
- Untar it.
- Import it into local mysql db.
Anyone know of a good way to handle this? Is there a gem I am unaware of? Is there a script you have handy?
The following script should achieve that:
(This assumes that you are on a UNIX system and have scp and tar installed…)