Sha256: 79bf586221e00444760393614b890f5c27ee1f25943c2ba0ab7fb651b5bfaeaf

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.5 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.6 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.7 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.8 lib/sprinkle/verifiers/process.rb