繁体   English   中英

Opsworks:cron:Ruby版本不正确

[英]Opsworks : cron : Ruby version is incorrect

我的目标是设置一个cron条目,以在我的Opsworks rails应用程序层上运行rake任务。 我已在此处找到有关此主题AWS doco

我的厨师职位:

cron_env = {"PATH" => "/usr/local/bin:$PATH"}
cron "warm up the cache" do
  environment cron_env
  hour "5"
  minute "10"
  command "cd /srv/www/myapp/current && RAILS_ENV=production bundle exec rake cache:warm_api"
end

实例上的crontab:

user@myinstance:~$ sudo crontab -l -u root
# Chef Name: warm up the cache
PATH=/usr/local/bin:$PATH
10 5 * * * cd /srv/www/myapp/current && RAILS_ENV=production bundle exec rake cache:warm_api

我的红宝石-v在/ usr / local / bin中:

user@myinstance:~$ /usr/local/bin/ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

问题:

在执行期间,我的Cron无法使用正确的红宝石。

/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/definition.rb:385:in `validate_ruby!': Your Ruby version is 1.9.3, but your Gemfile specified 2.1.2 (Bundler::RubyVersionMismatch)
    from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler.rb:117:in `setup'
    from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/setup.rb:17:in `<top (required)>'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require

事实证明这是Opsworks中的暂时故障。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM