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.