Module: Sprinkle::Verifiers::Process

Defined in:
lib/sprinkle/verifiers/process.rb

Overview

Process Verifier

Contains a verifier to check that a process is running.

Example Usage

verify { has_process 'httpd' }

Instance Method Summary collapse

Instance Method Details

#has_process(process) ⇒ Object

Checks to make sure process is a process running on the remote server.



16
17
18
19
20
21
22
23
24
25
# File 'lib/sprinkle/verifiers/process.rb', line 16

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