RVM/rbenv [SOLVED] RVM 环境无法在 Cron 中加载

lanisle · June 04, 2012 · Last by lanisle replied at June 04, 2012 · 3176 hits

要用 backup 来备份 VPS 上的站点

用 rvm.io 提供的方法(https://rvm.io/integration/cron/)都试了一遍,都无法使用。

调试方法:

*/1 * * * * source /usr/local/rvm/environments/default; echo $PATH 2>&1 > /root/debug.log

log 中的内容为:/usr/bin:/bin

系统邮件内容:/bin/sh: source: not found

备份脚本:

0 4 * * * source /usr/local/rvm/environments/default; backup perform --trigger vpsites > /dev/null

翻出去解决了,关键在 cron 默认的 shell 执行环境加载得不完全,需要一个 seperated shell。

问题细节和解决方法都在 http://reality.hk/posts/2011/11/24/cron-job-with-rvm

huacnlee in Clockwork - 代替 Cron 的计划任务工具 mention this topic. 03 Apr 10:57
lanisle closed this topic. 10 Jan 18:39
You need to Sign in before reply, if you don't have an account, please Sign up first.