I'm currently trying to use the whenever gem to schedule my tasks but I do not know how it works. I've tried following the steps at https://github.com/javan/whenever but I got stuck at schedule.rb file. What am I supposed to write inside here? I want my app to call a method every minute using this gem. How am I supposed to do it? Can anyone give me a clue on how to do so?
UPDATE
1) schedule.rb
every 1.minute do
runner "Newsletter.schedule_email"
end
2) newsletter.rb
def schedule_email
...*codes*...
end
Well, the basic form would be:
every 1.minute do
runner "Class.method_name"
end
If your stuff isn't running, this question might have some useful info: Whenever cron job is not working in rails 3
There's also a railscast about cron jobs in general and Whenever in particular: http://railscasts.com/episodes/164-cron-in-ruby