2016-08-10 40 views
0

我使用OSX和我創建的路徑中的Ruby腳本:/Users/diogo/workspace/outros/crawler_trf名稱爲get_news.rbcrontab的不發現/識別路徑

所以,我想可以通過crontab使用以下行來執行它:*/1 * * * * 'ruby /Users/diogo/workspace/outros/crawler_trf/get_news.rb' > /tmp/crawler_trf.out和我我得到了錯誤:/bin/sh: ruby /Users/diogo/workspace/outros/crawler_trf/get_news.rb: No such file or directory

我真的一直在尋找我的答案,但我沒有找到任何東西。

回答

0

cron是餵養你的命令:

'ruby /Users/diogo/workspace/outros/crawler_trf/get_news.rb' > /tmp/crawler_trf.out 

/bin/sh作爲-信息,但沒有'ruby /Users/diogo/...'命令,有可能是一個ruby命令,可以採取/Users/diogo/...作爲參數,但這樣放下報價:

*/1 * * * * ruby /Users/diogo/workspace/outros/crawler_trf/get_news.rb > /tmp/crawler_trf.out 

您可能還想包含ruby的完整路徑,或者至少確保中有PATH設置。