How to clear sessions with cron?

works for me:

class Cronjobs def self.clear_sessions Session.delete_all([“updated_at <= ?”, Time.now.yesterday.strftime(‘%Y-%m-%d’)]) end end

and then in your crontab:

20 0 * * * /path/to/rails/app/current/script/runner ‘Cronjobs.clear_sessions;’ -e production

ed