I just launched my first ROR app and i need to implement the session
database cleanup. I am new to cronjobs. I have used one once but it
was all copy/paste.
I was hoping someone knew of a good tutorial or resource to get started
here or might be able to give me a little help.
I have seen a lot of posts that reference setting a cron job to clear
old sessions but I am not clear on:
Can you put the script in the crontask?
If not, should the .rb live anywhere (/username/) or does it have to be
in one of the cron directories (houly/daiily/etc)?
Or can you just run straight SQL out of the crontab (that seems like it
would be the most efficient)?
I saw the “ruby script/runner” reference in a couple of posts. Is this
some other way of solving this problem?
Are there a few ways to solve this problem? Would anyone mind telling me
which is the best one?
My guess, at this point, is that i set the cronjob to run a standalone
.rb that does something like
Session.find(:all, :conditions => [“updated_at <=
?”,date_to_delete_from]).destroy
Anyway, i think it is clear that I am confused any help or even a little
direction would be greatly appreciated.
Thanks