Sha256: 70dc977ee17b353c7722e8f889bd302e4a06c48d5f91b4b91f18408ad20fc530
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 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 = path } op.on("-v", "--verbose") { options[:verbose] = true } op.on("-d", "--daemon") { options[:daemon] = true } op.on("-h", "--help") { show_help } args = op.parse(*ARGV) # == Configuration ========================================================== if (config_file) if (File.exist?(config_file)) config = YAML.load(open(config_file)) end end config = DEFAULT_CONFIG.merge(config).merge(options) # == Main =================================================================== MysqlReplicationHelper::Daemon.new(config).run!
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
theworkinggroup-mysql-replication-helper-0.2.0 | lib/mysql_replication_helper/daemon_launcher.rb |