module Nephos::Bin::Daemon
Public Class Methods
detach!()
click to toggle source
# File lib/nephos-server/bin-helpers.rb, line 42 def self.detach! Process::daemon(true, false) File.write(get_pid_file, Process::pid.to_s) end
get_pid()
click to toggle source
# File lib/nephos-server/bin-helpers.rb, line 51 def self.get_pid return nil if not File.exist?(get_pid_file) v = File.read(get_pid_file) v = Integer(v) rescue nil return v end
get_pid_file()
click to toggle source
# File lib/nephos-server/bin-helpers.rb, line 47 def self.get_pid_file return ".pid" end
kill!()
click to toggle source
# File lib/nephos-server/bin-helpers.rb, line 28 def self.kill! d = get_pid return false unless d begin Process::kill(2, d) rescue => err raise "Cannot kill #{d} ! (#{err.message})" if $debug raise "Cannot kill #{d} !" ensure File.delete(get_pid_file) end return true end
started?()
click to toggle source
# File lib/nephos-server/bin-helpers.rb, line 24 def self.started? get_pid != nil end