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.
http://mmonit.com/monit/ 2009/4/27 Pelletier Carl <[email protected]> > Hi, I am running a backgroundrb server and would like to known, what is the > best way of knowing when the backgroundrb dies? > 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. > > For testing purpose, i manually kill backgroundrb to see how my script > react. This working well, but the Exception send by backgroundrb is :exit. > > What should be the error message when backgroundrb is dead? > this is the snippet of code: > > rescue Exception => e > log.info "[ERROR] | FATAL ERROR" > log.info "[ERROR] | #{e.message}" *# The error I got is: exit* > log.info "[ERROR] | #{e.backtrace}" > log.info "[INFO] | Sending failure email..." > > SystemMailer.deliver_failure(summary,"FAILURE","#{File.join(LOG_PATH,name)}") > persistent_job.finish! > end > > this is the output in my log file: > > Mon Apr 27 10:59:50 -0400 2009 | [ERROR] | FATAL ERROR > Mon Apr 27 10:59:50 -0400 2009 | [ERROR] | exit > 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- > etc... > > Thanks > > p.S. sorry for bad english... > > _______________________________________________ > Backgroundrb-devel mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/backgroundrb-devel >
_______________________________________________ Backgroundrb-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/backgroundrb-devel
