Suggestion for reload action (USR2)

Iñaki Baz Castillo ibc at
Wed Jan 20 03:54:12 EST 2010

Hi, when Unicorn receives a USR2 it invokes the original script and arguments 
and creates a new master as a child.

However when running this new master there could be something to treat 
different as when we run Unicorn for first time.

For example:
- In the initial unicorn master I want it to create a Posix_mq, and in case it 
already exists then I want it to delete and create again.
- But in the new master (when USR2) I just want it to reuse the existing 

Note this is just an example, perhaps not the best however.

So I suggest the following:

- When unicorn master receives a USR2 it executes the original executable 
withthe original arguments plus "--reload". This just would mean that the new 
instance is a reloaded process. The executable could store such option 
somewhere so the application could know it and react.

This would involve just three changes:

- Add an option "--reload" in OptionParser in bin/unicorn.
- Store such option somewhere so it can be readed later by the Rack 
application or other library.
- Add "--reload" to the list of original arguments when receiving USR2.


Iñaki Baz Castillo <ibc at>

More information about the mongrel-unicorn mailing list