Created
February 12, 2010 23:52
-
-
Save edipofederle/303117 to your computer and use it in GitHub Desktop.
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
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