Module: Izzup

Defined in:
lib/izzup.rb,
lib/izzup/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.izzup(process) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/izzup.rb', line 21

def self.izzup(process)
    up = 0
    begin
        up = %x{ps ax | grep #{process} | grep -v grep | wc -l}.strip().to_i
    rescue
        raise "#{self.name} will probably only work on a *NIX machine"
    end
    up
end

.request(*args) ⇒ Object

see if they are up



13
14
15
16
17
18
19
# File 'lib/izzup.rb', line 13

def self.request(*args)
    found = 0
    args.each do |p|
        found = found + izzup(p)
    end
    found == args.length
end

.require(*args) ⇒ Object

require these or fail



6
7
8
9
10
# File 'lib/izzup.rb', line 6

def self.require(*args)
    args.each do |p|
        raise "#{self.name} dying because #{p} is not up" unless izzup(p) == 1
    end
end