在生产中运行rake任务时出错

时间:2014-01-23 09:31:36

标签: ruby-on-rails ruby-on-rails-4 rake rake-task whenever

当我跑步时

$bundle env

得到的结果为:

Bundler 1.5.2
Ruby 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
Rubygems 2.2.1
rvm 1.25.15 (stable)
GEM_HOME /usr/local/rvm/gems/ruby-2.1.0
GEM_PATH /usr/local/rvm/gems/ruby-2.1.0:/usr/local/rvm/gems/ruby-2.1.0@global
rubygems-bundler (1.4.2)

但是在运行时每次和运行时都会运行 tail -f log/cron_log.log我遇到了以下问题

/usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.5.0/lib/bundler/spec_set.rb:92:in `block in materialize'/usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.5.0/lib/bundler/spec_set.rb:92:in `block in materialize'/usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.5.0/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.1.1 in any of the sources (Bundler::GemNotFound)

我该如何解决这个问题?

修改

$crontab -l

35 0 * * * / usr / bin / apt-get update

35 1 * * * / usr / bin / apt-get -y upgrade

# Begin Whenever generated tasks for: trrm
PATH=/usr/local/rvm/gems/ruby-2.1.0/bin:/usr/local/rvm/gems/ruby-2.1.0@global/bin:/usr/local/rvm/rubies/ruby-2.1.0/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

* * * * * /bin/bash -i -c 'cd /var/www/trrm && RAILS_ENV=production bundle exec rake ad_has_expired_task --silent >> log/cron_log.log 2>&1'

0,15,30,45 * * * * /bin/bash -i -c 'cd /var/www/trrm && RAILS_ENV=production bundle exec rake ad_going_to_expire_task --silent >> log/cron_log.log 2>&1'

# End Whenever generated tasks for: trrm

0 个答案:

没有答案