shell脚本通过cron与rvm执行rails runner

Mr_*_*zle 3 bash cron runner rvm

crontab我有:

0,30 * * * * sh /path/to/my/script.sh
Run Code Online (Sandbox Code Playgroud)

在我的script.sh身上:

#!/bin/bash
rvm use 1.9.2@r321
cd /path/to/my/proyect
rails runner rails_script.rb
Run Code Online (Sandbox Code Playgroud)

不过,这并不加载rvm1.9.2,它停留在系统设置至极上1.8.7我的情况.

我该怎么做才能确保跑步者在宝石rvm集中运行?1.9.2r321

mpa*_*pis 6

至少有4种方法可以让cron使用RVM:https://rvm.io/integration/cron/

我个人更喜欢 2. Loading RVM environment files in shell scripts.