Module: Daemon::PidFile

Defined in:
lib/chocolate_rain/daemon.rb

Class Method Summary collapse

Class Method Details

.recall(daemon) ⇒ Object



21
22
23
# File 'lib/chocolate_rain/daemon.rb', line 21

def self.recall(daemon)
  IO.read(daemon.pid_fn).to_i rescue nil
end

.store(daemon, pid) ⇒ Object



17
18
19
# File 'lib/chocolate_rain/daemon.rb', line 17

def self.store(daemon, pid)
  File.open(daemon.pid_fn, 'w') {|f| f << pid}
end