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

I have a simple script that starts up a unicorn instance (on Ubuntu 12.04LTS).


case "$1" in
       echo "starting"
       cd /path && bundle exec unicorn -c /path/config/unicorn.rb -D -E production
      echo "Stopping Unicorn Instances"
      kill `cat /tmp/`
    echo "sending USR2 to all unicorns"
    kill -s USR2 `cat /tmp/`
exit 0

It behaves correctly when called: /etc/init.d/ start

I want it to start on boot, so I ran: update-rc.d -f defaults

When I now reboot I get the following error:

/etc/rc2.d/ 10: /etc/rc2.d/ bundle: not found

I checked the bundle command, and it's installed in /usr/local/bin, same for the ruby command.

It appears that on boot the PATH does not yet include /usr/local/bin. How can I fix this?

share|improve this question
up vote 7 down vote accepted

Initscripts are responsible for setting an appropriate path themselves. Set the $PATH variable at the top of the script:

share|improve this answer
Ok, thanks. Didn't know that. It's fixed now! – Peterdk Feb 22 '13 at 23:00
Alternatively you should be able to set PATH="$PATH:/usr/local/bin" to append your required paths to the variable, rather than overriding the $PATH variable entirely. – Jason Ilicic Nov 9 '15 at 3:52

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.