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 want to supervise my Rails application running on unicorn with monit.

Running following two from shell when logged in as root would fail:

  • "/srv/app/current/config/ start"
  • su -c "/srv/app/current/config/ start" app

What does work is:

  • su -c "/srv/app/current/config/ start" - app

It does not suprise me, I'm using rbenv which requires some alterations in $PATH which I do in .bash_profile. Unfortunately, I can't make it working with monit. I've prepared some script which bases on what I found in Internet:

check process unicorn
  with pidfile /srv/app/shared/pids/
  start program = "/srv/app/current/config/ start" as uid app and gid app
  stop program = "/srv/app/current/config/ stop" as uid app and gid app
  group www

It looks like .bash_profile is not read in this case — how to change it? Or, alternatively, how to add few directories to $PATH which is used by monit?

Thanks for any help.

share|improve this question

I've just find out that the best thing to do is to make this with shebang pointing to /bin/bash and set $PATH in the beginning of script.

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.