Question

I would like to use Whenever gem to run scheduled jobs in my RoR application. I run the bundle install and this is my schedule.rb:

every 1.minute do
   runner "Event.executeEvents"
end

My Event.executeEvents method is a simple log entry:

class Event < ActiveRecord::Base

  def executeEvents
    puts "executeEvents at [" + Time.now.inspect + "]"
  end
end

If I execute whenever in command line, I got this:

$ whenever                       
* * * * * /bin/bash -l -c 'cd C:/dev/yanpyapi && bin/rails runner -e production '\''Event.executeEvents'\'''

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

Nothing is executed.

What I´m missing?

Do I need to initilize it somehow? I have read some doc about capistrano and RVM, but I don´t know what is this for...

Was it helpful?

Solution

You will have to execute

whenever -i

to add the jobs to crontab

OTHER TIPS

Also, #executeEvents is defined as an instance method.

In the schedule.rb file you are calling it as class method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top