9 thoughts on “Why you need to manage Ruby sessions”

  1. 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.

  2. Also, in worst case, you can always set up a cronjob to purge that directory every day/week/month (whichever seems appropriate).

  3. 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

  4. 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 .)

Comments are closed.