1.我使用whenever gem 来定时启动 rails runner 任务;可是定时任务的log显示:
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'railties' (>= 0.a) among 17 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0:/root/.gem/ruby/2.3.0', execute `gem env` for more information
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/rvm/gems/ruby-2.3.0/bin/rails:22:in `<main>'
from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
我也gem install railties了,可是还是这样,我的ruby version:2.3.0,rails version:4.1.0;
本人ruby 小白,求帮助
自问自答来更新答案,原来是“whenever +cron”的坑,原因是cron中没有加入关于 GEM_PATH的参数,
中看看有没有加入GEM_PATH参数,如果没有
3.crontab -e 编辑 cron表,添加:
大功告成了。