Class: Specinfra::Command::Base::Process

Inherits:
Specinfra::Command::Base show all
Defined in:
lib/specinfra/command/base/process.rb

Class Method Summary collapse

Methods inherited from Specinfra::Command::Base

create, escape

Class Method Details

.check_count(process, count) ⇒ Object



15
16
17
# File 'lib/specinfra/command/base/process.rb', line 15

def check_count(process,count)
  "test $(ps aux | grep -w -- #{escape(process)} | grep -v grep | wc -l) -eq #{escape(count)}"
end

.check_is_running(process) ⇒ Object



11
12
13
# File 'lib/specinfra/command/base/process.rb', line 11

def check_is_running(process)
  "ps aux | grep -w -- #{escape(process)} | grep -qv grep"
end

.count(process) ⇒ Object



7
8
9
# File 'lib/specinfra/command/base/process.rb', line 7

def count(process)
  "ps aux | grep -w -- #{escape(process)} | grep -v grep | wc -l"
end

.get(process, opts) ⇒ Object



3
4
5
# File 'lib/specinfra/command/base/process.rb', line 3

def get(process, opts)
  "ps -C #{escape(process)} -o #{opts[:format]} | head -1"
end