I'm building a Rails project that has a cron-type job that I'm managing with Rufus Scheduler. I have two questions about how to set this up appropriately in Rails:
Where's the best place to put the job's code?
Where should I place the Rufus code to schedule the job? How should I kick it off?
...
Is there anyway to setup simple task scheduling inside of a rails app? There are pieces of code that I want to run every hour, or every day or every week. I don't want to break them out into separate scripts that I then have to schedule via cron jobs. If I did that, then I'd have to remember to backup the scripts, and if I rebuild a serv...
My rails app kicks off a process with rufus-scheduler in an initializer. Here's a stripped-down version of the initializer's code:
# config.logger isn't available here, so we have to grab it from the Rails object
logger = RAILS_DEFAULT_LOGGER
logger.warn(Time.now.to_s + ": Starting Rufus Scheduler")
# run every Wednesday at 10 AM
cro...
I'm running an application that kicks off a Rufus Scheduler process in an initializer. The application is running with Passenger in production and I've noticed a couple weird behaviors:
First, in order to restart the server and make sure the initializer gets run, you have to both touch tmp/restart.txt and load the app in a browser. At t...