Welcome Guest | Login

Expiring old active record sessions, & rotating production.log?

I guess these are the two final housekeeping things i need to sort out for my app.

How are you guys approaching these two tasks? (i'm using activerecord session storage)

cheers!

2007-06-16 02:27 PM

For expiring old active record sessions, you need to execute
CGI::Session::ActiveRecordStore::Session.delete_all ["updated_at < ?", 2.weeks.ago.to_s(:db)]
So in crontab
23 3 */14 * * /usr/local/bin/ruby /home/usrname/path/to/script/runner -e production "CGI::Session::ActiveRecordStore::Session.delete_all [\"updated_at < ?\", 2.weeks.ago.to_s(:db)]"
for rotating logs add the following to your environment.rb to keep, for example, 100 logfiles of 1MB each.

config.logger = Logger.new("#{RAILS_ROOT}/log/#{ENV['RAILS_ENV']}.log", 100, 1048576)

2007-06-16 05:16 PM

Thanks William. I added these instructions and they seem to be working as expected :)

2007-06-17 06:39 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.