4 class ProcessRunning < PollCondition
5 attr_accessor :pid_file, :running
9 valid &= complain("You must specify the 'pid_file' attribute for :process_running") if self.pid_file.nil?
10 valid &= complain("You must specify the 'running' attribute for :process_running") if self.running.nil?
15 return !self.running unless File.exist?(self.pid_file)
17 pid = File.open(self.pid_file).read.strip
18 active = System::Process.new(pid).exists?
20 (self.running && active) || (!self.running && !active)