Created
June 10, 2011 21:32
-
-
Save cristianrasch/1019820 to your computer and use it in GitHub Desktop.
Script de backup del dominio lacie-unlam.org
This file contains 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
# flesystem: http://www.lacie-unlam.org:2082/getbackup/backup-lacie-unlam.org-6-10-2011.tar.gz | |
# db : http://www.lacie-unlam.org:2082/getsqlbackup/lacieunl_mysql.sql.gz | |
require "date" | |
require "net/http" | |
today = Date.today | |
backup_dir = today.strftime("%d_%m_%Y") | |
Dir.mkdir(backup_dir) unless File.directory?(backup_dir) | |
user, passwd = ENV["hosting_user"], ENV["hosting_passwd"] | |
raise "Falta setear user y/o passwd del hosting, env vars hosting_user y hosting_passwd" unless user && passwd | |
uris_filenames = { | |
"/getsqlbackup/lacieunl_mysql.sql.gz" => "lacieunl_mysql.sql.gz", | |
"/getbackup/backup-lacie-unlam.org-#{today.strftime("%e-%m-%Y").lstrip}.tar.gz" => "backup-lacie-unlam.org_#{today.strftime("%d_%m_%Y")}.tar.gz" | |
} | |
uris_filenames.each { |uri, filename| | |
`wget lacie-unlam.org:2082#{uri} --http-user=#{user} --http-password=#{passwd} --output-document=#{File.join(backup_dir, filename)}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment