Sorry, the problem with the above solution is that both the parent and child processes will write out their pid to the worker's pid file. We just want the child so change it to:
ruby
after_fork do |server, worker|
ifProcess.ppid > 1# Not the daemon
child_pid = server.config[:pid].sub('.pid', ".#{worker.nr}.pid")
File.open(child_pid, "wb") {|f| f << Process.pid }
endend
Sorry, the problem with the above solution is that both the parent and child processes will write out their pid to the worker's pid file. We just want the child so change it to:
Add this to the bottom of your unicorn.rb
so that each unicorn worker creates its own PID. See this post for more info.
Very useful. Thanks, Ryan.
I did have to change a few things before it worked in Rails 3.0 though. I had to remove the html hash in the delete form.
<%= form_tag request.url, method: :delete do %>
And I needed to add a delete method to the application_controller:
After that it worked beautifully.
Hi Ryan,
It looks like the caboo.se domain name has lapsed and has been taken over by a squatter.
Your pastie link to the original code will work if you update it to:
http://pastie.org/172566
Thanks so much for your screencasts. I refer back to them frequently.