How to get cron to work when using Javan - whenever Rails

I installed my schedule.rb file as follows.

set :cron_log, "/log/cron_log.log"
if Rails.env.development?
  every 1.minute do
    runner "SomeModel.move_values"
    runner "SomeOtherModel.dispense"
   end
end

I also make it work in development mode whenever --update-crontab trunk --set environment = development

But my model methods (class methods) are never called. Is there a way to check if it is configured correctly. when I just use the update, it resets the settings to use the working environment.

+3
source share
2 answers

I just did using the same javan-every plugin.

crontab -l. , crontab , , - .

set :environment, RAILS_ENV schedule.rb, .

: http://railscasts.com/episodes/164-cron-in-ruby

, , : webbasedcron

+2

Run   --set environment = test -w

crontab , , , .

+1

Source: https://habr.com/ru/post/1722576/


All Articles