Removing Stale Rails Sessions

Since version 1.1, Rails stores its session files in RAILS_ROOT/tmp/sessions instead of in /tmp. That means you have to clean them up yourself! Here’s a line you can stick in your crontab, preferably prefixed with an @hourly.

find RAILS_ROOT/tmp/sessions \
-name "ruby_sess*" \
-cmin +45 -exec rm {} \;