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

link|improve this question
feedback

2 Answers

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.

link|improve this answer
feedback

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.

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

Your Answer

 
or
required, but never shown

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