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.
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/sessions mkdir 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.
Also, in worst case, you can always set up a cronjob to purge that directory every day/week/month (whichever seems appropriate).
Yea, I know all that (apart from the
rm -f
idea). This post was supposed to be a joke .)Ah, ok. Got it. :)
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
Paul, noticed you watched Flags of our Fathers. Just to let you know, Letters from IWO JIMA was awesome.
Yeah, that’s what I’ve figured out judging by the awards alone. I really can’t wait to see it! :)
rake tmp:sessions:clear
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 .)