Sha256: 5949e1440a0c56dca1f525262e7fe68db62d2f413ba1e9803ba545cc05c917da

Contents?: true

Size: 504 Bytes

Versions: 1

Compression:

Stored size: 504 Bytes

Contents

module God
  module Conditions
    
    class ProcessNotRunning < PollCondition
      attr_accessor :pid_file
      
      def valid?
        valid = true
        valid &= complain("You must specify the 'pid_file' attribute for :process_not_running") if self.pid_file.nil?
        valid
      end
    
      def test
        return false unless File.exist?(self.pid_file)
        
        pid = File.open(self.pid_file).read.strip
        System::Process.new(pid).exists?
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
god-0.1.0 lib/god/conditions/process_not_running.rb