2011-09-09 10 views
0

Cronジョブがレールで動作していません3.私が使用しているコードは次のとおりです。生産モードのルビーでcronジョブが動作しません

schedule.rbファイル

every 1.hours do 
    command "cd /home/me/my_app/current" 
    rake "thinking_sphinx:index RAILS_ENV=production" 
end 

every 1.day, :at => '12.01 am' do 
    command "cd /home/me/my_app/current" 
    rake "messages_counter_for_user_and_group RAILS_ENV=production" 
    command "cd /home/me/my_app/current" 
    runner "RAILS_ENV=production User.update_all(:daily_message_count => 0)" 
end 

カピストラーノデプロイスクリプトから: -

task :long do 
transaction do 
    cron_tab_activate 
end 

task:cron_tab_activate, :roles=>:app do 
send(run_method, "cd #{current_path} && RAILS_ENV=#{stage} whenever --update-crontab test ") 
end 

私はRVMを使用しています。 Ruby 1.9.2、Rails 3.0.10

答えて

0

カスタムカピストラのタスクを使用する代わりに、gemが提供するcapistranoタスクをロードすることをお勧めします。

deploy.rbに入れる:

require 'whenever/capistrano' 
関連する問題