Sha256: 36874639570a725a3419a92fab3021a00d5b2276e68db16b8ccd4f5f13fc49b2
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
#!/usr/bin/env ruby # # Daemonize module # require 'rubygems' require 'yaml' require 'optparse' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..')) require 'mysql_replication_helper' # == Constants ============================================================== CONFIG_FILE_LOCATIONS = [ "/etc/replication-helper.conf", "/etc/replication-helper/config", "~/.replication-helper/config" ].collect { |p| File.expand_path(p) }.freeze DEFAULT_CONFIG = { } # == Options ================================================================ op = OptionParser.new options = { } config = { } config_file = nil op.on("--master-socket=s") { |socket| options[:master_socket] = socket } op.on("--master-data=s") { |dir| options[:master_data] = dir } op.on("--master-user=s") { |name| options[:master_user] = name } op.on("--slave-socket=s") { |socket| options[:slave_socket] = socket } op.on("--slave-data=s") { |dir| options[:slave_data] = dir } op.on("--slave-user=s") { |name| options[:slave_user] = name } op.on("-c", "--config=s") { |path| config_file = nil } op.on("-v", "--verbose") { options[:verbose] = true } op.on("-h", "--help") { show_help } args = op.parse(*ARGV) # == Configuration ========================================================== [ CONFIG_FILE_LOCATIONS, config_file ].flatten.each do |config_file| if (File.exist?(config_file)) config = YAML.load(open(config_file)) break end end config = DEFAULT_CONFIG.merge(config.inject({ }) { |h,(k,v)| h[k.to_sym] = v; h }).merge(options) # == Main =================================================================== MysqlReplicationHelper::Daemon.new(config).run!
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mysql-replication-helper-0.2.1 | lib/mysql_replication_helper/daemon_launcher.rb |