问题描述
0/5 * * * */bin/bash -l -c 'cd/home/mss/ruby/example && RAILS_ENV=development/usr/local/bin/bundle exec rake check_me_out --silent >>/tmp/cron_log.记录 2>&1'
0/5 * * * * /bin/bash -l -c 'cd /home/mss/ruby/example && RAILS_ENV=development /usr/local/bin/bundle exec rake check_me_out --silent >> /tmp/cron_log.log 2>&1'
上面的 cron 抛出一个错误bash: bundle: command not found..."
Above cron throws an error "bash: bundle: command not found..."
该命令在命令行中工作正常
The command works just fine from the command line
任何帮助将不胜感激.
推荐答案
好的,所以我开始工作了.Cron 不加载配置文件设置.我不得不将 bash_profile 作为命令的一部分加载,现在它可以工作了.
Okay so I got this working. Cron does not load the profile settings. I had to load the bash_profile as part of the commands and now it works.
0/5 * * * */bin/bash -l -c 'source ~/.bash_profile && cd/home/mss/ruby/example && RAILS_ENV=development bin/rake check_me_out --silent >>/tmp/cron_log.log2>&1'
0/5 * * * * /bin/bash -l -c 'source ~/.bash_profile && cd /home/mss/ruby/example && RAILS_ENV=development bin/rake check_me_out --silent >> /tmp/cron_log.log 2>&1'
这篇关于Rake Cron 作业错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!