Created
February 4, 2012 22:11
-
-
Save mauricio/1740578 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
#!/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