[Backgroundrb-devel] how to know when backgroundrb server die

Max Williams toastkid.williams at gmail.com
Tue Apr 28 04:32:27 EDT 2009


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 <carl at 2be.ca>

> 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
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20090428/5086ca4a/attachment.html>


More information about the Backgroundrb-devel mailing list