每当gem不会更新crontab任务时 [英] Whenever gem won't update crontab tasks

查看:133
本文介绍了每当gem不会更新crontab任务时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Slicehost 2岁以上的切片上一直使用"everything gem".但是,我无法在新切片上执行相同的操作.

I have been using the whenever gem on my 2+ year old slice at Slicehost. I can't however do the same on my new slice.

主要区别在于我现在在我的MBP和片上都运行RVM.我也在运行Rails3.我有Rubygems v 1.5.0和最新版本的RVM,Ruby 1.9.2p136,Capistrano以及几乎所有其他软件包.

Main differences is that I'm now running RVM on both my MBP and the slice. I am also running Rails 3. I've got Rubygems v 1.5.0 and latest versions of RVM , Ruby 1.9.2p136, Capistrano and about every other package out there.

我已经尝试了上百万种内容,阅读了所有文档,并且到目前为止,我使用的每当是gem版本0.6.2.我还查看了有关SO和Google相关主题的所有问题.

I have tried a million things, read all the docs and as of now I'm using the whenever gem version 0.6.2. I have also looked at all questions on related topics on SO as well as Google.

这是deploy.rb中的代码:

Here is the code in deploy.rb:

namespace :deploy do
  ...
  desc "Update the crontab file"
  task :update_crontab, :roles => :db do
    run "cd #{release_path} && whenever --update-crontab #{application}"
  end   
end

after 'deploy:update_code', 'deploy:update_crontab'

这是我运行"cap deploy"后收到的错误消息

Here is the error message I get after running 'cap deploy'

failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.2' -c 'cd /home/deploy/public_html/lasource/releases/20110209201551 && /home/deploy/.rvm/gems/ruby-1.9.2-p136/bin/whenever --write-crontab'" on lasource.ohlalaweb.com

任何建议都将受到欢迎.

Any suggestions will be welcome.

顺便问一下,capistrano日志在哪里?

By the way, where are the capistrano logs?

多亏了Simone的建议,添加了"bundle exec",我设法完成了cap部署例程,因为一切进展顺利.但是,新问题是我的crontab文件仍然没有任务,并且没有使用其4个任务创建我的部分.

Having added 'bundle exec' thanks to the Simone's suggestion, I managed to complete the cap deploy routine as it everything went well. The new problem however is that my crontab file is still empty of tasks and did not create my section with its 4 tasks.

推荐答案

如果使用Rails 3,请记住使用bundle exec执行命令.

If using Rails 3, remember to execute the command with bundle exec.

namespace :deploy do
  desc "Update the crontab file"
  task :update_crontab, :roles => :app, :except => { :no_release => true } do
    run "cd #{release_path} && bundle exec whenever --update-crontab #{application}"
  end
end

这篇关于每当gem不会更新crontab任务时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆