Rails cron every,bundle:command not found [英] Rails cron whenever, bundle: command not found
本文介绍了Rails cron every,bundle:command not found的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图每天执行一次耙子任务。发生此错误
/ bin / bash:bundle:command not found
/home/app/.rvm/ ruby / ruby-1.9.2-p180 / lib / ruby / site_ruby / 1.9.1 / rubygems / dependency.rb:247:在`to_specs':找不到bundler(> = 0)在[minitest-1.6.0 ,rake-0.8.7,rdoc-2.5.8](Gem :: LoadError)
从/home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9。 1 / rubygems / dependency.rb:256:in`to_spec'
从/home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb :1210:in'gem'
从/home/app/.rvm/gems/ruby-1.9.2-p180/bin/bundle:18:in`< main>'
这是我的crontab
#Begin每当生成的任务:/home/af/www/app/releases/20120216172204/config/schedule.rb
PATH=/home/af/.rvm/gems/ruby-1.9.2-p180@global / bin:/ usr / local / sbin:/ usr / local / bin:/ usr / sbin:/ usr / bin:/ sbin:/ bin:/ usr / games
0 0 * * * / bin / bash -l -c'cd / home / af / www / app / releases / 20120216172204&& rvm 1.9.1-p180; RAILS_ENV = production /home/af/.rvm/gems/ruby-1.9.2-p180/bin/bundle exec rake daily:stats --silent>> /home/af/www/app/releases/20120216172204/log/cron.log 2>& 1'
#End每当生成的任务:/ home / af / www / app / releases / 20120216172204 / config / schedule.rb
我不知道为什么它不工作。如果我运行命令:cd / home / af / www / app / releases / 20120216172204& rvm 1.9.1-p180; RAILS_ENV = production /home/af/.rvm/gems/ruby-1.9.2-p180/bin/bundle exec rake daily:stats --silent>> /home/af/www/app/releases/20120216172204/log/cron.log 2>& 1
它工作正常,不知道这里发生了什么。
解决方案我下午一起玩,一个更好的解决方案。这是我想出来的
bundle install --binstubs
pre>
然后运行
bin / rake daily:stats
I am trying to use whenever to execute a rake task onces a day. Im getting this error
/bin/bash: bundle: command not found /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError) from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec' from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem' from /home/app/.rvm/gems/ruby-1.9.2-p180/bin/bundle:18:in `<main>'
Here is my crontab
# Begin Whenever generated tasks for: /home/af/www/app/releases/20120216172204/config/schedule.rb PATH=/home/af/.rvm/gems/ruby-1.9.2-p180@global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games 0 0 * * * /bin/bash -l -c 'cd /home/af/www/app/releases/20120216172204 && rvm 1.9.1-p180; RAILS_ENV=production /home/af/.rvm/gems/ruby-1.9.2-p180/bin/bundle exec rake daily:stats --silent >> /home/af/www/app/releases/20120216172204/log/cron.log 2>&1' # End Whenever generated tasks for: /home/af/www/app/releases/20120216172204/config/schedule.rb
I'm at a loss as to why it isn't working. If I run the command:
cd /home/af/www/app/releases/20120216172204 && rvm 1.9.1-p180; RAILS_ENV=production /home/af/.rvm/gems/ruby-1.9.2-p180/bin/bundle exec rake daily:stats --silent >> /home/af/www/app/releases/20120216172204/log/cron.log 2>&1
It works fine, not sure whats going on here.
解决方案I played around with this all afternoon and couldn't find a better solution. Here is what I have come up with
bundle install --binstubs
and then run
bin/rake daily:stats
这篇关于Rails cron every,bundle:command not found的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文