Rails Whenever the specified environment

I use whenever I create a cronjob for my Rails application. Rails 4.2.1

In schedule.rb, I have something like this:

every 13.minutes do
   rake "crons:dosomething"
end

      

This creates a cronjoblike:

 RAILS_ENV=production bundle exec rake crons:dosomething

      

The problem is that this only works cronjobs for a production environment ... but I need a cronjob and also in tests and development

I've tried this:

every 13.minutes do
   rake "crons:dosomething", :environment => :development
   rake "crons:dosomething", :environment => :test
   rake "crons:dosomething", :environment => :production
end

      

the problem is that the second rake is running before the first is fully completed, is there any solution for this problem?

+3


source to share





All Articles