Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/unicorn.sh start"
  • su -c "/srv/app/current/config/unicorn.sh start" app

What does work is:

  • su -c "/srv/app/current/config/unicorn.sh 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/unicorn.pid
  start program = "/srv/app/current/config/unicorn.sh start" as uid app and gid app
  stop program = "/srv/app/current/config/unicorn.sh 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

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

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.