Aaron Kulkis wrote:
Jaco Carlson wrote:
Can you safely delete all files in /tmp?
Yes.
No!

Any files which are still in use will be in an OPEN status.
The process which has the file open will have a handle to
the file, and accesses the file through the handle (not
the pathname).
Wrong. You are forgetting about Shell scripts. AFAIK the bash does not even have the concept of file handles, so all programs reference files by their name. As an example, take /sbin/conf.d/SuSEconfig.postfix which creates a directory in /tmp and references files by name. Deleting everything in /tmp while scripts like this are running may lead to completely undefined results. Especially because many scripts do not check for errors when writing.

Even if you have a program written in C/C++ that uses file handles all the time: What happens to the directories they create in /tmp? The directories get deleted and next time the program wants to create a file in that directory it will fail! And what happens if different layers of abstraction within a program close and re-open files in /tmp?

Deleting only old files may also cause problems if you have shell scripts that run for a long time. On a desktop machine, these could be shell wrappers around GUI applications (used e.g. by Firefox/Seamonkey). If you only suspend/resume your system instead of shutting it down, this script may be running for days or weeks if the application does not get closed, crashes or you have to update your kernel.

The only way I know of that is 100.0% FHS compliant (see [1]) is to wipe /tmp at boot time and leave it alone at all other times. This can be configured in /etc/sysconfig/cron as Josef Assad already wrote.


Regards
nordi


[1] http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to