Sha256: 50f32d9cae7a120b880e3b15b9cc0c49503addb4884583e15c28a3d9e5b9d48d

Contents?: true

Size: 727 Bytes

Versions: 4

Compression:

Stored size: 727 Bytes

Contents

module Sprinkle
  module Verifiers
    # = Process Verifier
    #
    # Contains a verifier to check that a process is running.
    #
    # == Example Usage
    #
    #   verify { has_process 'httpd' }
    #
    module Process
      Sprinkle::Verify.register(Sprinkle::Verifiers::Process)

      # Checks to make sure <tt>process</tt> is a process running
      # on the remote server.
      def has_process(process)
        if RUBY_PLATFORM =~ /win32/
          command = "tasklist /fo table /nh | findstr /c:\"#{process}\""
          command += ' > NUL 2>&1' unless logger.debug?
        else
          command = "ps aux | grep '#{process}' | grep -v grep"
        end
        @commands << command
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lachlan-sprinkle-0.0.1 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.2 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.3 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.4 lib/sprinkle/verifiers/process.rb