module HareDo::Service::Config

Public Instance Methods

daemonPid() click to toggle source

@return Returns PID of running daemon if it corresponds to a running process. Returns nil otherwise.

# File src/lib/haredo/service/config.rb, line 16
def daemonPid()
  pid = File.open(@pid_file, 'a+').read().strip.chomp
  
  return nil if pid.size == 0

  if Dir.exist?("/proc/#{pid}")
    return pid 
  end

  return nil
end