Module: DatabaseStalker::Util

Defined in:
lib/database_stalker/util.rb

Class Method Summary collapse

Class Method Details

.runned_tail_pidsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/database_stalker/util.rb', line 5

def runned_tail_pids
  pids = ''
  IO.popen("ps x | grep 'tail -f -n 0' | grep -v grep | awk '{print $1}'") do |io|
    while true
      buffer = io.gets
      break if buffer.nil?
      pids += buffer
    end
  end
  pids.split("\n").map do |pid|
    pid.to_i
  end
end