Skip to content

Instantly share code, notes, and snippets.

@camwest
Created March 1, 2009 17:50
Show Gist options
  • Save camwest/72411 to your computer and use it in GitHub Desktop.
Save camwest/72411 to your computer and use it in GitHub Desktop.
#upload the file
put(File.read("/tmp/#{dbname}-snapshot.sql.bz2"), "/tmp/#{dbname}-snapshot.sql.bz2", :mode => 0666)
#import the database
run "bzcat /tmp/#{dbname}-snapshot.sql.bz2 | mysql -u #{dbuser} -p #{dbname}" do |ch, stream, out |
ch.send_data "#{dbpass}\n" if out=~ /Enter password:/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment