Articles tagged 'cron'
December 16, 2011
This post was originally published in the Rambling Labs Blog on December 16, 2011.
Long time no post! I’ve been really busy these days with some projects. Yet, here I am again, so here it goes.
A couple of days ago, I started working on a big story in one of those projects I’m currently working on. It’s one of those things that needs to be run a couple of times a day… yeah, a scheduled background job.
Basically, what it need to do is check some database records, check their expiration date against the current date, and take some actions for each one of the expired ones. Simple enough, right?
I went ahead and wrote a rake task that would do the heavy work. Something like this:
task :check_expired_records do Record.where('expired =…