How to automate the restarting of Unicorn?

Pai-Hung Chen phc at zestcash.com
Fri Oct 7 23:20:58 EDT 2011


Hi,

I have a question about automating the restarting of Unicorn with the
following steps, and much appreciate your help.

Assumption: (i) "pid" is set to unicorn.pid in the config file; (ii) a
Unicorn process is already running.

(1) kill -USR2 `cat unicorn.pid` (via Capistrano deployment task for example)
(2) Inside the "before_exec" hook in the config file, do: kill -QUIT
`cat unicorn.pid.oldbin`

My question is: By the time the "before_exec" hook is executed, is it
guaranteed that unicorn.pid.oldbin ahas lready created (otherwise we
have a racing condition here)? Or is there a better way to achieve
what I want?

Please Cc me as I am not on the mailing list.

Please also let me know if there is a better place to ask this question.

Thanks,
Pai-Hung


More information about the mongrel-unicorn mailing list