[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: How to enable Debian to automatically clear the tmp directory



>From: Richard Möhn [mailto:richard.moehn@gmx.de] 
>Subject: Re: How to enable Debian to automatically clear the tmp directory
>
>On Thu, Aug 28, 2008 at 10:39:05AM -0500, Ryan Klein wrote:
>> I have been searching for a way to have Debian automatically remove  
>> files in the /tmp directory after a period of time. We need it mainly  
>> for removing old session files that grow quite rapidly (a rate of 10 per  
>> second). I am hoping Debian has a built in utility, otherwise a package  
>> will suffice if not a simple bash script. Thanks for your input.
>>
>
>It seems to be possible to do this with a cronjob.
>
>With the best greetings
>
>Richard

I second the cronjob. Just have something along the lines of:
find /tmp -type f -ctime +1

Obviously, you will need to set ctime to be the number you need it to be. Once you know that the files it returns are indeed the ones you want to delete then add "-exec rm -rf {} \;" to the end and toss it into cron.

If someone has a better way, please comment.

Have fun!
~S~




Reply to: