Class: Specinfra::Command::Alpine::Base::Process
- Defined in:
- lib/specinfra/command/alpine/base/process.rb
Class Method Summary collapse
- .check_count(process, count) ⇒ Object
- .check_is_running(process) ⇒ Object
- .get(process, opts) ⇒ Object
Methods inherited from Base
Class Method Details
.check_count(process, count) ⇒ Object
16 17 18 |
# File 'lib/specinfra/command/alpine/base/process.rb', line 16 def check_count(process, count) "test $(ps -ocomm | grep -w -- #{escape(process)} | grep -v grep | wc -l) -eq #{escape(count)}" end |
.check_is_running(process) ⇒ Object
12 13 14 |
# File 'lib/specinfra/command/alpine/base/process.rb', line 12 def check_is_running(process) "ps -ocomm | grep -w -- #{escape(process)} | grep -qv grep" end |
.get(process, opts) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/specinfra/command/alpine/base/process.rb', line 3 def get(process, opts) col = opts[:format].chomp('=') if col == 'args' "ps -o #{col} | grep #{escape(process)} | head -1" else "ps -o #{col},args | grep -E '\\s+#{process}' | awk '{ print $1 }' | head -1" end end |