bin/syslogstash in syslogstash-2.1.0 vs bin/syslogstash in syslogstash-2.2.0

- old
+ new

@@ -17,18 +17,21 @@ syslogstash = Syslogstash.new(cfg) sig_r, sig_w = IO.pipe Signal.trap("USR1") do - sig_w.print '1' + sig_w.print '1' end Signal.trap("USR2") do - sig_w.print '2' + sig_w.print '2' end Signal.trap("URG") do - sig_w.print 'U' + sig_w.print 'U' end +Signal.trap("HUP") do + sig_w.print 'H' +end Thread.new do loop do begin c = sig_r.getc @@ -39,9 +42,12 @@ logger.level += 1 unless logger.level == Logger::ERROR logger.info("SignalHandler") { "Received SIGUSR2; log level is now #{Logger::SEV_LABEL[logger.level]}." } elsif c == 'U' cfg.relay_to_stdout = !cfg.relay_to_stdout logger.info("SignalHandler") { "Received SIGURG; Relaying to stdout is now #{cfg.relay_to_stdout ? "enabled" : "disabled"}" } + elsif c== 'H' + logger.info("SignalHandler") { "Received SIGHUP" } + syslogstash.force_disconnect! else logger.error("SignalHandler") { "Got an unrecognised character from signal pipe: #{c.inspect}" } end rescue StandardError => ex logger.error("SignalHandler") { (["Exception raised: #{ex.message} (#{ex.class})"] + ex.backtrace).join("\n ") }