在我运行它时安装 rvm 后
source $HOME/rvm/scripts/rvm
我得到错误
-bash: /root/rvm/scripts/rvm: No such file or directory
在我运行它时安装 rvm 后
source $HOME/rvm/scripts/rvm
我得到错误
-bash: /root/rvm/scripts/rvm: No such file or directory
参考:问题部署 Ruby+RVM 和 daemontools
我找到了答案,但查看使用 rvm 安装的 rvmsudo 脚本,这是一个有效的运行脚本:
#!/bin/sh
# redirect stderr to stdout
exec 2>&1
cd /app
# load rvm
. /usr/local/rvm/scripts/rvm
# select ruby version for this application
rvm use 1.9.1
# # depending on your configuration you may need to provide the absolute path to rvm, like that:
# /usr/local/bin/rvm use 1.9.1
# build the exec command line preserving the rvm environment
command="exec sudo -u app_user /usr/bin/env PATH='$PATH'"
[[ -n "${GEM_HOME:-}" ]] && command="${command} GEM_HOME='$GEM_HOME' "
[[ -n "${GEM_PATH:-}" ]] && command="${command} GEM_PATH='$GEM_PATH' "
# this is where your real command line goes
command="${command} ruby main.rb"
# run the application
eval "${command}"
尝试源 ~/.rvm/scripts/rvm。退出当前的 shell,然后重试它应该可以工作。