Getting something to monitor itself and tell you when it dies is always going to be prone to failure, for obvious reasons. We use Monit for this sort of thing - if a process dies it sends a notification and then restarts it. <br>
<br><a href="http://mmonit.com/monit/">http://mmonit.com/monit/</a><br><br><div class="gmail_quote">2009/4/27 Pelletier Carl <span dir="ltr"><<a href="mailto:carl@2be.ca">carl@2be.ca</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">Hi, I am running a backgroundrb server and would like to known, what is the best way of knowing when the backgroundrb dies?<div><br></div><div>What I am doing is that my worker run in a big try catch. When the script failed, the catch is run. So I can clean my stuff, send my alert email and exit.</div>
<div><br></div><div>For testing purpose, i manually kill backgroundrb to see how my script react. This working well, but the Exception send by backgroundrb is :exit.</div><div><br></div><div>What should be the error message when backgroundrb is dead?</div>
<div>this is the snippet of code:</div><div><br></div><div><div> rescue Exception => e</div><div> <a href="http://log.info" target="_blank">log.info</a> "[ERROR] | FATAL ERROR"</div><div> <a href="http://log.info" target="_blank">log.info</a> "[ERROR] | #{e.message}" <b># The error I got is: exit</b></div>
<div> <a href="http://log.info" target="_blank">log.info</a> "[ERROR] | #{e.backtrace}"</div><div> <a href="http://log.info" target="_blank">log.info</a> "[INFO] | Sending failure email..."</div>
<div> SystemMailer.deliver_failure(summary,"FAILURE","#{File.join(LOG_PATH,name)}")</div><div> persistent_job.finish! </div><div> end</div><div><br></div><div>this is the output in my log file:</div>
<div><br></div><div><div>Mon Apr 27 10:59:50 -0400 2009 | [ERROR] | FATAL ERROR</div><div>Mon Apr 27 10:59:50 -0400 2009 | [ERROR] | exit</div><div>Mon Apr 27 10:59:50 -0400 2009 | [ERROR] | /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.14/bin/../lib/packet/packet_core.rb:210:in `exit'/opt/local/lib/ruby/gems/1.8/gems/packet-0.1.14/bin/../lib/packet/packet_core.rb:210:in `shutdown'/opt/local/lib/ruby/gems/1.8/gems/packet-0.1.14/bin/../lib/packet/packet_core.rb:138:in `start_reactor'/opt/local/lib/ruby/gems/1.8/gems/activesupport-</div>
<div>etc...</div><div><br></div></div></div><div>Thanks</div><div><br></div><div>p.S. sorry for bad english...</div></div><br>_______________________________________________<br>
Backgroundrb-devel mailing list<br>
<a href="mailto:Backgroundrb-devel@rubyforge.org">Backgroundrb-devel@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/backgroundrb-devel" target="_blank">http://rubyforge.org/mailman/listinfo/backgroundrb-devel</a><br></blockquote></div><br>