Created
September 27, 2012 19:04
-
-
Save blasterpal/3795806 to your computer and use it in GitHub Desktop.
Fetch a DB Backup from another server on EY
This file contains hidden or 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
| #!/usr/bin/ruby | |
| if ARGV.size < 1 | |
| puts "you need to supply bucket" | |
| exit | |
| end | |
| bucket = ARGV[1] | |
| puts "fetching list of prod backups" | |
| list = `sudo /usr/local/ey_resin/bin/eybackup -l BAM -e mysql -b #{bucket}` | |
| puts list.split("\n") | |
| latest_file = list.split('\n').first.split("\n").select{|ea| ea =~ /^[0-9]*:/}.last | |
| latest_index = latest_file.split(":").first | |
| puts "Downloading #{latest_file}" | |
| `sudo /usr/local/ey_resin/bin/eybackup -e mysql -d #{latest_index}:BAM -b #{bucket}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment