On a server that's up 24/7/365: where and how are the cleanup of /tmp (and /var/tmp) defined / controlled / configured?
2 Answers
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.

- 12,184
- 7
- 48
- 69
-
the atime thing could really create ulcers ;) – slashmais Sep 30 '10 at 07:52
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
.

- 8,847
- 3
- 30
- 34

- 2,364
- 18
- 10