[plug] Keeping a running server clean

Bernd Felsche bernie at innovative.iinet.net.au
Sun Oct 24 11:37:44 WST 2004


Tim White <weirdo at tigris.org> writes:
>James Devenish wrote:

>>In message <4179D57D.3040403 at tigris.org>
>>on Sat, Oct 23, 2004 at 11:52:29AM +0800, Tim White wrote:

>>>I didn't find any that appeared to clean up stale locks, or /tmp.

>>With Linux, it is typical that /tmp only gets cleaned upon reboot.
>>This is nice for desktop machines. In contact, some BSD operating
>>systems clean /tmp regularly. Most people would not expect /tmp to
>>be flushed on a regular basis, so what you have experienced is
>>"normal". However, "stale locks" is not very explanatory. Is this
>>a netware thing? I don't know anything about netware.

>A stale lock is when a process has a file locked and then dies without 
>unlocking it. I haven't seen it happen under Linux yet buy it commonly 
>happens under windows and I have now also seen it under netware (5, 6 
>will run on a BSD Kernel)

If it's a kernel-level operation, then the process' death will
result in the file lock being released (POSIX).

If the lock is held within a file-server process, then a restart of
just those services at an off-peak time should remove any stale locks.

>I am going to hack up a little app to see if I can get it to happen
>under Linux.

>Do people know of a script to clean up /tmp? Obviously it should only 
>clean files not in use.

How about the one that cleans /tmp on reboot?

You certainly don't want to remove any files that are currently open
(use lsof) and probably not any files that have been accessed in the
past week; especially if the system has been up for a long time.
-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!




More information about the plug mailing list