Why you need to manage Ruby sessions
Huston, we have a problem…
$ cd tmp/sessions/ $ rm * -bash: /bin/rm: Argument list too long
Opening up mc and deleting by hand helped. There were 22507 session files taking up about 1.7MB of space. I suppose it’s time to look at other session storing methods.

January 30th, 2007 at 12:59 am
Are Ruby sessions similar to PHP sessions? And if yes, doesn’t rails have a mechanism for purging old and expired sessions?
Did you try:
rm -f tmp/sessionsmkdir tmp/sessions
This way you avoid the argument expansion thing, I think. To tell you the truth I actually never had that issue in bash.
January 30th, 2007 at 1:00 am
Also, in worst case, you can always set up a cronjob to purge that directory every day/week/month (whichever seems appropriate).
January 30th, 2007 at 1:56 am
Yea, I know all that (apart from the
rm -fidea). This post was supposed to be a joke .)January 30th, 2007 at 5:35 am
Ah, ok. Got it.
January 30th, 2007 at 9:50 pm
Or you can use the handy find command (helpful if you put in a cronjob)
# find sessions older than a week and toast them
find tmp/sessions -atime +7 -exec rm {} \;
# to see what it would delete w/o deleting it:
find tmp/sessions -atime +7 -exec echo {} \;
turn that into a script and put into your crontab to run nightly at 3am
0 3 * * * /home/user/rails/cleanup_sessions.sh
February 5th, 2007 at 10:01 am
Paul, noticed you watched Flags of our Fathers. Just to let you know, Letters from IWO JIMA was awesome.
February 5th, 2007 at 12:56 pm
Yeah, that’s what I’ve figured out judging by the awards alone. I really can’t wait to see it!
February 21st, 2007 at 7:25 am
rake tmp:sessions:clear
February 21st, 2007 at 11:12 am
Evan: Oh, believe me, I know. It seems that you just did not get the joke. But don’t worry, you are not alone. Apparently I must work more on my comedy skills .)