diff options
author | elijah <elijah@riseup.net> | 2014-10-29 16:42:38 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-10-29 16:42:38 -0700 |
commit | 05f7d47166230c0556140f2a349439b3bc27d347 (patch) | |
tree | abb208983137e589c2eacbc6ae8913e1555bc580 | |
parent | 5c39ab10b490c3571d1169128c7e3095e9b6fefc (diff) |
don't try to remove pid file when we get a singal to halt, we won't have permissions anyway.
-rw-r--r-- | lib/nickserver/daemon.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/nickserver/daemon.rb b/lib/nickserver/daemon.rb index c6752d8..9a50e36 100644 --- a/lib/nickserver/daemon.rb +++ b/lib/nickserver/daemon.rb @@ -113,11 +113,7 @@ module Nickserver else bail "Error reading pid file #{file}" end - begin - FileUtils.rm Config.pid_file - rescue Errno::EACCES - bail 'insufficient permission to remove pid file' - end + remove_pid_file else bail "could not find pid file #{file}" end @@ -125,18 +121,20 @@ module Nickserver puts "Failed to stop: #{e}" end + def remove_pid_file + FileUtils.rm Config.pid_file + rescue Errno::EACCES + bail 'insufficient permission to remove pid file' + end + # # stop when we should # def catch_signals - sigtrap = proc { - command_stop - $stdout.puts "\nQuit" - $stdout.flush - exit - } ["SIGTERM", "SIGINT", "SIGHUP"].each do |signal| - Signal.trap(signal, sigtrap) + Signal.trap(signal) { + exit + } end end |