From 49c9e2f095fdc9cb815490c8e5afd5453be5fbf5 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 17 May 2013 23:08:53 -0700 Subject: rolled custom daemon code to better match the way daemons are supposed to work under debian. --- bin/nickserver | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) (limited to 'bin') diff --git a/bin/nickserver b/bin/nickserver index b0cabac..de4a818 100755 --- a/bin/nickserver +++ b/bin/nickserver @@ -1,4 +1,5 @@ #!/usr/bin/ruby + # # Nickserver key discovery daemon # @@ -19,40 +20,8 @@ rescue LoadError end end -# -# Handle craceful Ctrl-C -# -Signal.trap("SIGINT") do - puts "\nQuit" - exit -end - -# -# Handle '--version' ourselves -# -if ARGV.grep(/--version/).any? - puts "nickserver #{Nickserver::VERSION}, ruby #{RUBY_VERSION}" - exit(0) -end - -# -# Start the daemon -# -require 'daemons' - -options = {:app_name => 'nickserver', :multiple => false, :backtrace => true} - -# pick where the pid file should go (must be readable/writable by current user) -if File.writable?('/var/run/nickserver') - options.merge!(:dir_mode => :normal, :dir => '/var/run/nickserver') -elsif ENV["USER"] == "root" - options.merge!(:dir_mode => :system) -else - options.merge!(:dir_mode => :normal, :dir => '/tmp') -end - -Daemons.run_proc('nickserver', options) do +Nickserver::Daemon.run do EventMachine.run do Nickserver::Server.start end -end +end \ No newline at end of file -- cgit v1.2.3