Skip to content

Instantly share code, notes, and snippets.

@cristianrasch
Created June 10, 2011 21:32
Show Gist options
  • Save cristianrasch/1019820 to your computer and use it in GitHub Desktop.
Save cristianrasch/1019820 to your computer and use it in GitHub Desktop.
Script de backup del dominio lacie-unlam.org
# 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