You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aparna Pratap <ap...@gmail.com> on 2007/02/15 08:09:46 UTC

Cleanup of tempdir in tomcat

Hi
I am using Tomcat 5.0.25. In my application images are getting stored
permenantly inside tempdir of Tomcat. This is happening when the request is
not processed completely. I want to clean the tempdir either with every
request or after its size reaches some limit.
Or after some time period but without writing cron jobs. Is there any
setting in tomcat to clean the tempdir when it crosses some size limit?
Can anybody help?

Thanks,
Aparna.

Re: Cleanup of tempdir in tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aparna,

Aparna Pratap wrote:
> I am using Tomcat 5.0.25. In my application images are getting stored
> permenantly inside tempdir of Tomcat. This is happening when the request is
> not processed completely. I want to clean the tempdir either with every
> request or after its size reaches some limit.

You don't want to do either of these. Regardless of the interval that
you check, you don't want to just start deleting files, or else you will
end up deleting files that are actually in use.

You should do a periodic cleanup (5 minutes, 30 minutes, one hour?) and
delete files that are older than a certain time. That way, you won't
accidentally delete something that is still in use.

> Or after some time period but without writing cron jobs. Is there any
> setting in tomcat to clean the tempdir when it crosses some size limit?
> Can anybody help?

Your basic options are to use an external scheduler (cron) or to use
something like Quartz (https://quartz.dev.java.net/) from within your
webapp.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF1GMN9CaO5/Lv0PARAtwHAJ4h5Brv2JApyItMfj9aanM755rrrwCfdDrj
Tv/BZ+PP3DALPtniKHzw7Zg=
=9YSM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org