Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created February 12, 2010 23:52
Show Gist options
  • Save edipofederle/303117 to your computer and use it in GitHub Desktop.
Save edipofederle/303117 to your computer and use it in GitHub Desktop.
Net::SSH.start( hostname, username, :password => password ) do |ssh|
puts "Gerando Backup"
ssh.exec("mysqldump --host=#{host} --user=#{user} --password=#{pass} --database #{database} > dump.sql")
begin
raise "Excecao" unless File.exist?('dump.sql', ".")
rescue ArgumentError => error
puts "Algo errado aconteceu"
rescue RuntimeError => error
puts "Arquivo dump.sql nao foi encontado. #{error}"
else
puts "Sucesso"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment