2016-05-25 13 views
0

レール。cronジョブをするたびに宝石のために働いていない、私はいつでも宝石をinstaled私は、IDEの雲9つの Railsの5</p> <p>を使用しています5

gem 'whenever', :require => false 

schedule.rb:コマンドラインで

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

every 2.minutes do 
    rake "subscription:send_mails" 
end 


namespace :subscription do 
    desc "Send dayly mails with new projects" 
    task send_mails: :environment do 

    Subscriber.where.not(categories: []).find_each do |subscriber| 
     projects = Project.where(categories: subscriber.categories, created_at: 1.days.ago) 
     SubscriptionMailer.send_email_with_new_projects(subscriber, projects).delivery_now 
    end 
    end 
end 

ラン:

bundle exec whenever 
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c 'cd /home/ubuntu/workspace && RAILS_ENV=production bundle exec rake subscription:send_mails --silent >> /home/ubuntu/workspace/log/cron.log 2>&1' 

## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated. 
## [message] Run `whenever --help' for more options. 

今すぐ開発モードでは、ローカルサーバーを実行しています。コードが実際に実行されているという証拠はありません。 log/cron.logは空です。私がしなかったいくつかのステップがありますか?

+0

、 'whenever'コマンドを実行してください。それはcrontabであなたの定義されたタスクを表示しますか? –

答えて

0

SSHワーク​​スペースを使用していない限り、CronジョブはCloud9で動作しません。


出典:プロジェクトのルートからHow to enable/run cron on Cloud9?

関連する問題