Class: ProcessSanity::Processes

Inherits:
Object
  • Object
show all
Defined in:
lib/process_sanity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#is_aggressiveObject

Returns the value of attribute is_aggressive.



3
4
5
# File 'lib/process_sanity.rb', line 3

def is_aggressive
  @is_aggressive
end

#namesObject

Returns the value of attribute names.



3
4
5
# File 'lib/process_sanity.rb', line 3

def names
  @names
end

Instance Method Details

#check_processesObject



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

def check_processes
  names.each do |process_name|
    id = system("pgrep -f #{process_name} > /dev/null 2>&1")
    unless id
      puts "SanityCheck: #{process_name} IS A DEPENDENCY YET IT IS NOT RUNNING!"
    end
  end
  if is_aggressive
    raise "SanityCheck:: YOU HAVE FORGOT TO PRE-RUN SOME PROCESSES"
  end
end