Module: Daemon::PidFile
- Defined in:
- lib/serverside/daemon.rb
Overview
Stores and recalls the daemon pid.
Class Method Summary collapse
-
.recall(daemon) ⇒ Object
Recalls the daemon pid.
-
.store(daemon, pid) ⇒ Object
Stores the daemon pid.
Class Method Details
.recall(daemon) ⇒ Object
Recalls the daemon pid. If the pid can not be recalled, an error is raised.
22 23 24 25 26 |
# File 'lib/serverside/daemon.rb', line 22 def self.recall(daemon) IO.read(daemon.pid_fn).to_i rescue raise 'Pid not found. Is the daemon started?' end |
.store(daemon, pid) ⇒ Object
Stores the daemon pid.
16 17 18 |
# File 'lib/serverside/daemon.rb', line 16 def self.store(daemon, pid) File.open(daemon.pid_fn, 'w') {|f| f << pid} end |