summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-05-17 23:08:53 -0700
committerelijah <elijah@riseup.net>2013-05-17 23:08:53 -0700
commit49c9e2f095fdc9cb815490c8e5afd5453be5fbf5 (patch)
tree9174074c041cbb4667c7b5cf33634f67738a38c8 /bin
parent51dc03481a9be5148f16e8022a1b00b658739ff3 (diff)
rolled custom daemon code to better match the way daemons are supposed to work under debian.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nickserver37
1 files changed, 3 insertions, 34 deletions
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