2 class ProcessNotRunning < Condition
3 attr_accessor :pid_file, :clean
12 valid = complain("You must specify the 'pid_file' attribute for :process_not_running") if self.pid_file.nil?
17 return false unless File.exist?(self.pid_file)
18 pid = File.open(self.pid_file).read.strip
24 File.delete(self.pid_file) rescue nil
30 def process_running?(pid)
31 cmd_name = RUBY_PLATFORM =~ /solaris/i ? "args" : "command"
32 ps_output = `ps -o #{cmd_name}= -p #{pid}`
33 !ps_output.strip.empty?