On Wed, May 5, 2010 at 9:38 AM, Chad Woolley <
thewoo...@gmail.com> wrote:
> Unfortunately, this same trick doesn't work for monit:
>
> start program = "/bin/bash --login -c '/path/to/myscript.rb start'"
> as uid myuser and gid myuser
OK, we figured this out.
The problem is that monit does not set the $HOME environment variable.
So, when bash runs, it parses ~/.bash_profile , which runs rvm. RVM
then ends up setting $rvm_path to '/.rvm' (not '/home/myuser/.rvm' as
it should be). After that point, even if you re-parse .bash_profile
or .bashrc, RVM won't reset $rvm_path because it is already set.
We got around this by adding this in front of the RVM line in
.bash_profile and .bashrc: "export HOME=/home/myuser; if [[ ..."
So, it seems like this is something that RVM should handle. Maybe by
our including our hack as part of the RVM post-setup init-script-hack
instructions, or maybe by just raising a descriptive error if $HOME is
not set so people using monit can find the error easier than we did.
In any case, it doesn't seem right that RVM goes ahead and sets
$rvm_path to a bogus value if $HOME is not set.