Skip to content

Instantly share code, notes, and snippets.

@jschoolcraft
Created May 5, 2011 15:06
Show Gist options
  • Save jschoolcraft/957216 to your computer and use it in GitHub Desktop.
Save jschoolcraft/957216 to your computer and use it in GitHub Desktop.
bit of my astrails-safe file, showing mysql command line batch execution
mysqldump do
options "-ceKq --single-transaction --create-options"
username = "some"
pass = "thing"
user username
password pass
socket "/var/run/mysqld/mysqld.sock"
dbs = IO.popen("/usr/bin/mysql -u #{username} -p#{pass} -e 'show databases' --batch --skip-column-names")
databases = dbs.readlines
dbs.close
databases.each do |db|
database db.chomp.to_sym
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment