Helper module with specific class-level functions to be used with +include MiGA::Common::WithDaemon+.
Path to the alive file
# File lib/miga/common/with_daemon_class.rb, line 13 def alive_file(path) File.join(daemon_home(path), '.daemon-alive') end
Path to the daemon home from the parent's
path
# File lib/miga/common/with_daemon_class.rb, line 7 def daemon_home(path) path end
When was a daemon last seen at path
?
# File lib/miga/common/with_daemon_class.rb, line 25 def last_alive(path) f = alive_file(path) f = terminated_file(path) unless File.exist? f c = File.read(f) return nil if c.nil? || c.empty? Time.parse(c) rescue Errno::ENOENT, ArgumentError return nil end
Path to the terminated file
# File lib/miga/common/with_daemon_class.rb, line 19 def terminated_file(path) File.join(daemon_home(path), '.daemon-terminated') end