Hi, I've modified bin/unicorn to start a DRb server before last lines:
MyApp::DRbServer.start(Process.pid)
Unicorn::Launcher.daemonize! if daemonize
Unicorn.run(app, options)
DRb server listens in port 5555. When I send a USR2 signal to unicorn master
process I get an error because DRb is started again so:
/usr/local/lib/ruby1.9/1.9.1/drb/drb.rb:861:in `initialize': Address already
in use - bind(2) (Errno::EADDRINUSE)
The only solution I can imagine is to trap USR2 signal:
MyApp::DRbServer.start(Process.pid)
trap("USR2") { ::DRb.stop_service }
Unicorn::Launcher.daemonize! if daemonize
Unicorn.run(app, options)
Unfortunatelly it doesn't work because Unicorn overrides the 'trap' call so I
don't get the USR2 signal.
Is there any way to achive this?
I could imagine a new config option "on_usr2" (or "before_reexec") so the
passsed block would be executed upon receipt of USR2 (before the real "reexec"
method).
Does it make sense?
Thanks a lot.
--
Iñaki Baz Castillo <[email protected]>
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying