Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On a server that's up 24/7/365: where and how are the cleanup of /tmp (and /var/tmp) defined / controlled / configured?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

In general that is entirely up to the distribution you are using, but you can assume that if something is being deleted it is done from a cronjob, and surely runs from /etc/cron.daily (could also be cron.weekly or /etc/cron.d).

If tmpwatch is installed then that is what is erasing your files and directories. In its most simple way it is executed as tmpwatch <hours> <dir1> [<dir2>, ...]

Another variant is tmpreaper.

share|improve this answer

I agree with Torian's suggestion of using tmpwatch. One thing to watch (har har) out for is that tmpwatch uses file atime by default to decide if a file should be deleted. If you are mounting your /tmp partition with noatime this can lead to problems. Use relatime instead, particularly since newer kernels have a much smarter handling of this flag.

share|improve this answer
    
the atime thing could really create ulcers ;) –  slashmais Sep 30 '10 at 7:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.