Diogo Amaral Diogo Amaral - 7 months ago 32
Ruby Question

Crontab dont find/recognize path

I'm using a osx and I created a ruby script in the path:

with name

So I tried to execute it via crontab with the following line:
*/1 * * * * 'ruby /Users/diogo/workspace/outros/crawler_trf/get_news.rb' > /tmp/crawler_trf.out
and I've got the error:
/bin/sh: ruby /Users/diogo/workspace/outros/crawler_trf/get_news.rb: No such file or directory

I really had searching for my answers for long but I didn't found nothing.


cron is feeding your command:

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

to /bin/sh as-is but there is no 'ruby /Users/diogo/...' command, there probably is a ruby command that can take /Users/diogo/... as an argument though so drop the quotes:

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

You might want to include the full path to ruby as well or at least make sure there's a PATH setting in your crontab.