与Cron工作一起耙任务

我正在尝试设置cron作业来每天运行一个rake任务。 我目前有以下cron工作(请注意,时间全是*因为我希望它在测试时每分钟运行一次)

* * * * * cd /home/jon/thestockenator/lib/tasks/ && ./get_current_data.sh 

在shell脚本中,我将整个PATH添加到cron运行它时的路径,并调用rake test_task。

我设置了一个基本的rake任务,只输出一些文本(因为我的真实需要一段时间才能运行)

 task :test_task do puts "this is a rake task" end 

在cron作业中运行时,cron作业肯定会运行并且which rake工作。

我通过将其添加到脚本来修复它:

source ~/.rvm/scripts/rvm