Skip to content

Instantly share code, notes, and snippets.

@mauricio
Created February 4, 2012 22:11
Show Gist options
  • Save mauricio/1740578 to your computer and use it in GitHub Desktop.
Save mauricio/1740578 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
=begin
PID="/usr/local/var/mysql/local.pid"
DATA_DIR="/usr/local/var/mysql"
BASE_DIR="/usr/local/Cellar/mysql/5.5.15"
PLUGIN_DIR="/usr/local/Cellar/mysql/5.5.15/lib/plugin"
LOG_ERROR="/usr/local/var/mysql/local.err.log"
trap "echo 'killing MySQL'; kill -SIGQUIT \`cat $PID\`" SIGQUIT SIGTERM
mysqld --basedir=$BASE_DIR --datadir=$DATA_DIR --plugin-dir=$PLUGIN_DIR --log-error=$LOG_ERROR --pid-file=$PID --console
=end
options = { :'pid-file' => "/usr/local/var/mysql/local.pid",
:'datadir' => "/usr/local/var/mysql",
:'basedir' => "/usr/local/Cellar/mysql/5.5.15",
:'plugin-dir' => "/usr/local/Cellar/mysql/5.5.15/lib/plugin",
:'log-error' => "/usr/local/var/mysql/local.err.log"}
trap 'QUIT' do
puts "received quit call"
exit(0)
end
trap 'TERM' do
puts "received term call"
exit(0)
end
trap 'HUP' do
puts "received hup call"
exit(0)
end
system( "" )
options_command = options.map { |k,v| "--#{k}='#{v}'" }.join(" ")
puts "final command -> #{options_command}"
system( "mysqld #{options_command} --console" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment