Permalink
Browse files

- Better exception handling

- Better signal handling
  • Loading branch information...
1 parent 0228fbc commit 1b97e5496c6a98438221c677d4ef6fcd7c482eef @ripienaar ripienaar committed Jul 19, 2010
Showing with 11 additions and 5 deletions.
  1. +11 −5 agent/puppetd/commander/puppetcommanderd
@@ -200,10 +200,14 @@ def background
pidfile.puts $$
end
- Signal.trap("HUP", "IGNORE")
-
loop do
- run(@config[:interval], @config[:concurrency])
+ begin
+ run(@config[:interval], @config[:concurrency])
+ rescue Exception => e
+ log("Runner raised an exception: #{e.class}: #{e}")
+ sleep 5
+ retry
+ end
end
end
@@ -213,8 +217,10 @@ end
log("Looping clients with an interval of #{@config[:interval]} minutes")
log("Restricting to #{@config[:concurrency]} concurrent puppet runs") if @config[:concurrency]
-Signal.trap("TERM") do
- exit!
+["TERM", "HUP"].each do |sig|
+ Signal.trap(sig) do
+ exit!
+ end
end
if @config[:daemonize]

0 comments on commit 1b97e54

Please sign in to comment.