Class: Foreman::Kicker::Watchdog

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman/kicker/watchdog.rb

Instance Method Summary collapse

Instance Method Details

#start(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/foreman/kicker/watchdog.rb', line 4

def start(*args)
  @pid = fork do
    trap(:TERM) do
      terminate(@executor.pid)
      Kernel.exit(0)
    end

    loop do
      @executor = Executor.new
      @executor.run(*args)
    end
  end
end

#stopObject



18
19
20
# File 'lib/foreman/kicker/watchdog.rb', line 18

def stop
  terminate(@pid)
end