# USR2 to unicorn with preloaded app

**URL:** <https://www.ruby-forum.com/t/usr2-to-unicorn-with-preloaded-app/223037>\
**Category:** Deployment\
**Created:** [September 19, 2012, 11:33pm UTC](https://www.ruby-forum.com/t/usr2-to-unicorn-with-preloaded-app/223037 "2012-09-19T23:33:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [September 19, 2012, 11:33pm UTC](https://www.ruby-forum.com/t/usr2-to-unicorn-with-preloaded-app/223037/1 "2012-09-19T23:33:42Z")

</div>

Just happened to me with great surprise, that a Rails 3.2 served with  
unicorn 4.3.1 did not reload after a USR2 signal.

In particular, this deploy was introducing ActiveAdmin. The admin routes  
kept sending me 404 until I did a full stop and start.

So what are the cases in which the USR2 signal is not enough to reload  
the app?

---

<div class="post-metadata">

**Author:** ![fregini](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a88e4f/32.png) [@fregini](https://www.ruby-forum.com/u/fregini)\
**Post date:** [September 21, 2012, 12:26am UTC](https://www.ruby-forum.com/t/usr2-to-unicorn-with-preloaded-app/223037/2 "2012-09-21T00:26:09Z")

</div>

We have had this same problem: we have a “hot deploy” system that  
deploys the new code, and then sends the USR2 signal to the master  
unicorn to restart. About 20% of the time (very rough estimate, no real  
research into that number) the unicorn master does not restart (though,  
annoyingly, the deploy still acts like it succeeded). They respond to  
KILL or QUIT but not USR2.

Edit: we are running Rails 3.0 and Unicorn 4.3.1

---

<div class="post-metadata">

**Author:** ![fregini](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a88e4f/32.png) [@fregini](https://www.ruby-forum.com/u/fregini)\
**Post date:** [September 21, 2012, 10:43am UTC](https://www.ruby-forum.com/t/usr2-to-unicorn-with-preloaded-app/223037/3 "2012-09-21T10:43:17Z")

</div>

Ciao,  
a github so che usavano questo script di god per monitorare unicorn.

> **[unicorn.god | The GitHub Blog](https://github.blog/2009-10-12-unicorn-god/)**
>
> Some people have been asking for our Unicorn god config. Here it is: # http://unicorn.bogomips.org/SIGNALS.html rails\_env = ENV\['RAILS\_ENV'\] || 'production' rails\_root = ENV\['RAILS\_ROOT'\] || "/data/github/current" God.watch do |w| w.name = "unicorn"...

---

<div class="post-metadata">

**Author:** ![fregini](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a88e4f/32.png) [@fregini](https://www.ruby-forum.com/u/fregini)\
**Post date:** [October 11, 2012, 10:14am UTC](https://www.ruby-forum.com/t/usr2-to-unicorn-with-preloaded-app/223037/4 "2012-10-11T10:14:41Z")

</div>

In this case, you just pass the old PID to kill

kill -s QUIT 23820 or you can take advantage of the fact this old PID is  
stored a known file (referenced in your error message) alongside the  
“current” PID, and execute:

kill -s QUIT `cat /home/user/app.git/tmp/unicorn.pid.oldbin`

Openwave has a highly experienced Ruby R. Development team
