Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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.