Module: MiGA::Common::WithDaemonClass
Overview
Helper module with specific class-level functions to be used with include MiGA::Common::WithDaemon.
Instance Method Summary collapse
-
#alive_file(path) ⇒ Object
Path to the alive file.
-
#daemon_home(path) ⇒ Object
Path to the daemon home from the parent’s
path. -
#last_alive(path) ⇒ Object
When was a daemon last seen at
path?. -
#terminated_file(path) ⇒ Object
Path to the terminated file.
Instance Method Details
#alive_file(path) ⇒ Object
Path to the alive file
14 15 16 |
# File 'lib/miga/common/with_daemon_class.rb', line 14 def alive_file(path) File.join(daemon_home(path), '.daemon-alive') end |
#daemon_home(path) ⇒ Object
Path to the daemon home from the parent’s path
8 9 10 |
# File 'lib/miga/common/with_daemon_class.rb', line 8 def daemon_home(path) path end |
#last_alive(path) ⇒ Object
When was a daemon last seen at path?
26 27 28 29 30 31 |
# File 'lib/miga/common/with_daemon_class.rb', line 26 def last_alive(path) f = alive_file(path) f = terminated_file(path) unless File.exist? f return nil unless File.exist? f Time.parse(File.read(f)) end |
#terminated_file(path) ⇒ Object
Path to the terminated file
20 21 22 |
# File 'lib/miga/common/with_daemon_class.rb', line 20 def terminated_file(path) File.join(daemon_home(path), '.daemon-terminated') end |