簡體   English   中英

任何寶石在通過capistrano部署時出錯時的Rails

[英]Rails whenever gem giving error when deploying via capistrano

我正在嘗試通過rails項目創建我的第一個cron作業。 運行cap deploy ,我收到此錯誤:

...
* 2013-01-01 22:29:00 executing `whenever:update_crontab'
  * executing "cd /var/www/vhosts/famnfo.com/releases/20130102042834 && bundle exec whenever --update-crontab FamNFo --set environment=production --roles db"
    servers: ["famnfo.com"]
    [famnfo.com] executing command
 ** [out :: famnfo.com] /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/core_ext/numeric/time.rb:49:in `days': wrong number of arguments (1 for 0) (ArgumentError)
 ** [out :: famnfo.com] from config/schedule.rb:23:in `initialize'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever/job_list.rb:25:in `instance_eval'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever/job_list.rb:25:in `initialize'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever.rb:15:in `new'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever.rb:15:in `cron'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever/command_line.rb:55:in `whenever_cron'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever/command_line.rb:106:in `updated_crontab'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever/command_line.rb:36:in `run'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/lib/whenever/command_line.rb:7:in `execute'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/gems/whenever-0.8.1/bin/whenever:41:in `<top (required)>'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/bin/whenever:19:in `load'
 ** [out :: famnfo.com] from /var/www/vhosts/famnfo.com/shared/bundle/ruby/1.9.1/bin/whenever:19:in `<main>'
    command finished in 2308ms
*** [deploy:update_code] rolling back
...

這是我的schedule.rb代碼:

set :output, "#{path}/log/cron.log"

every 1.day :at => "8:00am" do
    runner "BirthdayReminders.send_birthday_email_reminders"
end

我已將此添加到我的capistrano deploy.rb文件中

set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"
set :output, "#{path}/log/cron.log"

every 1.day :at => "8:00am" do
    runner "BirthdayReminders.send_birthday_email_reminders"
end

嘗試在白天添加逗號:

every 1.day, :at => "8:00am" do
  ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM