Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'ftools'
- # (db names and password changed in this paste to protect the (not so)innocent)
- # get the next directory
- ts = Time.now.to_s
- backupdir = "#{ENV['HOME']}/backups/db"
- # for each production database
- %w(prod_1 prod_2 prod_3).each do |db|
- # do an sql dump to our backup directory
- `mysqldump -u backup --password=xxx #{db} > #{backupdir}/#{db}.sql`
- end
- # store the changes as a commit in the backups/db git repo
- `cd #{backupdir} && git add . && git commit -m "data backup #{ts}" && cd -`
Add Comment
Please, Sign In to add comment