Created
February 4, 2011 12:23
-
-
Save jschoolcraft/811054 to your computer and use it in GitHub Desktop.
my astrails-safe backup (part of it anyway)
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
| mysqldump do | |
| options "-ceKq --single-transaction --create-options" | |
| username = "root" | |
| pass = "redacted" | |
| user username | |
| password pass | |
| socket "/var/run/mysqld/mysqld.sock" | |
| dbs = IO.popen("/usr/bin/mysql -u #{username} -p#{pass} -e 'show databases' --batch --skip-column-names") | |
| databases = dbs.readlines | |
| dbs.close | |
| databases.each do |db| | |
| database db.chomp.to_sym | |
| end | |
| end | |
| tar do | |
| options "-h" # dereference symlinks | |
| archive "dot-configs", :files => "/home/*/.[^.]*" | |
| ["/var/www/wp-sites", "/var/www/apps"].each do |directory| | |
| Dir.foreach(directory) do |sub_dir| | |
| target = "#{directory}/#{sub_dir}" | |
| if sub_dir.length > 2 # ignoring . and .. | |
| archive sub_dir, :files => "#{target}/current/", :exclude => ["#{target}/current/logs", "#{target}/current/tmp"] | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment