2

我希望您对我如何拥有橡胶 cron 以及何时 cron 一起生活有建议?正如您在下面的 crontab -l 输出中看到的那样,橡胶 cron 作业想要设置 PATH 变量。这会导致每当 gem 创建的 cron 作业失败。如果我注释掉 PATH 变量,那么橡胶 cron 作业会失败,因为它们无法找到 rvm。任何帮助将不胜感激。

这是我的 crontab -l 的输出

# cron clears out environment variables, but Rubber.root/script/rubber uses
# "rvm do default" to run, so no longer any need to setup ruby env vars here,
# all we need is PATH
PATH=/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
# don't need to set RUBBER_ENV for each script since we set it for all cron here
RUBBER_ENV=production
RAILS_ENV=production

# Roll all rails logs at midnight
0 0 * * * /mnt/stats-production/releases/20121209201953/script/rubber cron --task util:rotate_logs --directory=/mnt/stats-production/releases/20121209201953/log
# rubber-nginx-start

# Roll the nginx logs at midnight
0 0 * * * /mnt/stats-production/releases/20121209201953/script/rubber cron --task util:rotate_logs --directory=/mnt/nginx/logs
# rubber-nginx-end

# Begin Whenever generated tasks for: stats
0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /bin/bash -l -c 'cd /mnt/stats-production/releases/20121209201953 && script/rails runner -e production '\''Region.queue_worker'\'''

# End Whenever generated tasks for: stats

我收到的错误:

stdin: is not a tty
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /mnt/stats-production/releases/20121209201953/config/boot.rb:6:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from script/rails:5:in `<main>'
4

0 回答 0