bin/oversip in oversip-1.1.0.beta2 vs bin/oversip in oversip-1.1.0.beta3

- old
+ new

@@ -3,10 +3,12 @@ unless RUBY_VERSION >= "1.9.2" raise ::LoadError, "OverSIP requires Ruby version >= 1.9.2 (current version is #{RUBY_VERSION})" end +$LOAD_PATH.insert 0, File.expand_path(File.join(File.dirname(__FILE__), "../", "lib")) + # When OverSIP is executed automaticaly via the system init (i.e. after booting the host) # the Encoding.default_external is US_ASCII which causes fails when reading daat from # some files (i.e. the cacert.pem file which contains no valid US_ASCII symbols). So # make the default external encoding UTF-8 right now. ::Encoding.default_external = ::Encoding::UTF_8 @@ -21,16 +23,17 @@ module OverSIP class Executable + extend ::OverSIP::Logger @log_id = "executable" def self.run + $0 = ::File.basename(__FILE__) ::OverSIP::Logger.load_methods - extend ::OverSIP::Logger # Options by default. options = { :colorize => true } @@ -46,10 +49,12 @@ options[:pid_file] = value end opts.on("-p", "--process-name NAME", "Change the running process name, also affects to syslogger process and Posix Message Queue name (default 'oversip')") do |value| options[:process_name] = value + $0 = options[:process_name] + ::OverSIP::Logger.load_methods end opts.on("--config-dir DIR", "Absolute path to the directory with user configuration files (default '/etc/oversip/')") do |value| options[:config_dir] = value end @@ -164,16 +169,14 @@ end end # Set the command name (as it appears in "ps" output) to given --process_name option (-p) # or to the script filename otherwise. - $0 = options[:process_name] || ::File.basename(__FILE__) - - ::OverSIP.master_name = $0 + ::OverSIP.master_name = options[:process_name] || ::File.basename(__FILE__) + $0 = ::OverSIP.master_name log_system_info "master process name: #{::OverSIP.master_name}" ::OverSIP::Config.load options[:config_dir], options[:config_file] - log_system_info "applied configuration:" ::OverSIP::Config.print options[:colorize] log_system_info "creating Posix Message Queue for communicating master and syslogger processes" ::OverSIP.syslogger_mq_name = "/#{OverSIP.master_name}_syslogger" ::OverSIP::Logger.init_logger_mq options[:group]