Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Bash script has the following code that doesn't throw an error.

echo "Reloading Unicorn if USR2 is enabled"
kill -USR2 `cat $PID`
if [ -s $OLD_PID ]
kill -WINCH `cat $OLD_PID` && kill -QUIT `cat $OLD_PID`

The lack of error and the issuing of the new pid makes me think this works, but the old master or $OLD_PID stays around forever. Is it normal for the old pid to stay around for a long time? I get scared and just kill the thing, but I'm finally manning up to ask this question here.

Pt 2, do you need to define USR2 in the unicorn.rb file? I remember a couple of years ago reading that, but I came back to unicorn and tried it again and it now works, i think without modifications to config.

Do you use USR2 in production and if so, did you modify your config to do something to the old pid and when to kill it?

share|improve this question
up vote 0 down vote accepted

TLDR: This blog has a cool unicorn based gist that helps with creating the file and resetting the unicorn with USR2.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.