Rake Task with Cron Job

删除回忆录丶 提交于 2020-01-17 04:00:47

问题


I am trying to set up cron job to run a rake task daily. I currently have the following cron job (note, the time is all *'s because I want it to run every minute while testing)

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

In the shell script I added the entire PATH to whatever the path is when cron runs it and call rake test_task.

I set up a basic rake task that simply outputs some text (because my real one takes a while to run)

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

The cron job definitely runs and which rake works when run in the cron job.


回答1:


I fixed it by adding this to the script:

source ~/.rvm/scripts/rvm



来源:https://stackoverflow.com/questions/11571789/rake-task-with-cron-job

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!