[ic] Purging session/ and tmp/ - expireall, or rm?
interchange.mail at virgin.net
Fri Nov 21 17:28:09 EST 2003
Mike Heins wrote:
> Quoting ICdev (interchange.mail at virgin.net):
> > Hey,
> > I'm not quite clear on which method I should use in crontab to clear the
> > contents of the 'session' and 'tmp' directories.
> > In the icadvanced document, it says that if you're using DBM sessions,
> > you should use expireall. I am using standard session files, but having
> > searched the archives, people seem to be using expireall or plain old rm
> > arbitrarily, or even both, one after the other!
> > So, which of the following should I use?:
> > 20 4 * * * su -c "/usr/lib/interchange/bin/expireall -r" interch
> > or
> > 20 4 * * * find /var/lib/interchange/store_name/session -type f -mtime +2
> > | xargs rm -fv
> > 20 4 * * * find /var/lib/interchange/store_name/tmp -type f -mtime +2 |
> > xargs rm -fv
> > , or doesn't it matter? Shouldn't the parent directories of the session
> > files be deleted too?
> > I tried expireall manually - it took its time executing, but didn't seem
> > to have any affect on the stuff in session and tmp; I'm guessing that's
> > because it's less than a day old.
> > *Finally*, what if someone is placing an order just as their session
> > files are deleted with rm?
> I use a very simple little script I call clean_session_tmp to do it:
> for DIR in $*
> for i in session tmp
> if test -d $DIR/$i
> find $DIR/$i -type f -mmin +480 | xargs --no-run-if-empty
> rm find $DIR/$i -type d -empty -depth -mindepth 1 | xargs --no-run-if-empty
> rmdir else
> echo "$0: $DIR/$i doesn't exist."
> The 480 is 8 hours. You can change the number to what you want.
> It is called in cron:
> 22 4 * * * /usr/local/interchange/bin/clean_session_tmp /home/*/catalogs/*
Thank you Mike, that's very helpful.
I'm just wondering; if this is done *during* order processing, does IC (4.8.7)
have some kind of error handling in the event of a partially read session
More information about the interchange-users