Search code examples
ruby-on-rails-4rufus-scheduler

scheduling using Rufus-scheduler


I using the rufus-scheduler. There is this one function I want to call on every reboot and every 30 mins after that. I tried :

scheduler.every '30m' do
   .....
end

But the first time it does the task is 30 mins after server starts. Any help?


Solution

  • From reading the project README file, you can use :first with :now or :immediately, which schedules the job for immediate triggering. e.g.:

    scheduler.every '30m', :first => :now do
       .....
    end