Sha256: a4d9067626ef71dad0a9b7d2c30a40108fe0f4294b5a46aa7b46c88dfccb7750

Contents?: true

Size: 758 Bytes

Versions: 7

Compression:

Stored size: 758 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)
        process = process.to_s
        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

7 entries across 7 versions & 1 rubygems

Version Path
lachlan-sprinkle-0.0.10 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.11 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.13 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.14 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.15 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.16 lib/sprinkle/verifiers/process.rb
lachlan-sprinkle-0.0.9 lib/sprinkle/verifiers/process.rb