I do this in the Rails console:
job = scheduler.at 1.minute.from_now do Service.log.debug 'scheduler works' end
job.schedule_info
=> Wed, 07 Aug 2013 16:14:46 UTC 00:00
scheduler defined in another file:
require 'rubygems'
require 'rufus/scheduler'
def scheduler
@scheduler ||= Rufus::Scheduler.start_new
end
And when I start the console:
Service.log.debug 'scheduler works'
A service log file has been recorded.
Problem
scheduler.at 1.minute.from_now do Service.log.debug 'scheduler works' end
Not logged in a minute. What am I missing? How can I debug this?
Actual problem
I have a server in EC2 that seems to be shutting down and scheduled tasks are not running.
The thing is, in my development environment, I test a task in one minute and it works. This is on the server not in the console. The console, as I mentioned, fails.
Environment Dev
ruby 1.9.3p327 (patch 2012-11-10 37606) [x86_64-darwin12.0.0]
Thin 1.5.0
Remote environment
ruby 1.9.3p429 (printable version 2013-05-15 40747) [x86_64-linux]
apache2 2.2.22
passenger 4.0.5
Gems
rails 3.2.8
rufus-scheduler 2.0.18