wayneeseguin/rvm — Issue #586: non-interactive rvm-shell
Author: rogercampos
Created: 2011-11-09 11:32:40+00:00
State: open

Hi, I've come up with an error regardin rvm-shell after upgrading from 1.6 rvm series. I've first try to reinstall rvm completly with `rvm implode` and removing related files, but the issue persist after a clean installation. I'm now using a multi-user installation, 1.9.2 version.

I have monit configured like:

```
check process sphinx with pidfile /some/path/searchd.production.pid
start program = "/usr/local/rvm/bin/rvm-shell -c 'cd /path/to/app/current && RAILS_ENV=production bundle exec rake ts:start'"
as uid deployer and gid deployer
stop program = "/usr/local/rvm/bin/rvm-shell -c 'cd /path/to/app/current && RAILS_ENV=production bundle exec rake ts:stop'"
as uid deployer and gid deployer
```
But monit refuses to initialize with this error:

$rvm_path (/.rvm) does not exist./usr/local/rvm/scripts/rvm: line 154: __rvm_teardown: command not found

I've tracked it down to the `rvm-shell` script where you can read:

```
if [[ -z "${rvm_path:-}" ]]
then
if (( UID == 0 ))
then
rvm_path="/usr/local/rvm"
else
rvm_path="${HOME}/.rvm"
fi
export rvm_path
fi
```
As monit runs with a non-interactive shell and a minimal env, but as a 'deployer' user (not root), HOME is not set, so we end up with rvm_path set at "/.rvm". I've changed that line and monit can run as before.

Is there another way to workaround this? I'd like to work with `rvm-shell` as it provides an automatic way to load an interactive environment with rvm loaded.

Thank you!