Question: Following is link to my init script for unicorn.
<https://gist.github.com/1466775>

Restart command has never worked for me. I am using upgrade to restart unicorn after each deploy. But whenever there is major changes like new gems being added, upgrade won't work. Recently, i replaced hoptoad gem with airbrake and it errors out saying 'uninitialized constant Airbrake (NameError)'. But when i stopped and started unicorn again, it worked fine. Does the problem lies in init script or its different problem?

Thanks.

Answer: 
I had the same issue, but I was using rbenv which was installed on per user basis.
I used this [init script](https://github.com/railscasts/335-deploying-to-a-vps/blob/master/blog-nginx/config/unicorn_init.sh)

I figured out that since my rbenv installed on per user basis I need to slightly change this:

```
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"

```

with this:

```
CMD="cd $APP_ROOT; ~/.rbenv/bin/rbenv exec bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"

```

Hope it will help you!

P.S. or somebody else since it's an old question =)
I fixed this issue by changing my unicorn init.d script from

```
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E staging"

```

to this:

```
CMD="cd $APP_ROOT; BUNDLE_GEMFILE=$APP_ROOT/Gemfile bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E staging"

```

Which seems to point to the new bundle gemfile on every new release.
Taking inspiration from [this merge request](https://github.com/sosedoff/capistrano-unicorn/commit/c1e7a3f2794dd070367d0808ad102a6d20d39cf2#diff-14f6e151876ce4733900b16e3c2e8ddb)