[plug] Keeping a running server clean
James Devenish
devenish at guild.uwa.edu.au
Sun Oct 24 10:26:14 WST 2004
In message <417B0EE1.2010908 at tigris.org>
on Sun, Oct 24, 2004 at 10:09:37AM +0800, Tim White wrote:
> 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)
My apologies...I don't know what a "netware server" is, so I am not sure
that I understand your situation. I assumed you had a "Linux" system
running "Netware services". There are about 35 different types of locks
in UNIX systems, so "detecting them and cleaning them up" is a vague
proposition.
> Do people know of a script to clean up /tmp? Obviously it should only
> clean files not in use.
Well, it will depend on what criteria are appropriate for your machine.
At the simplest level (quick-and-dirty and untested):
for i in /tmp /var/tmp; do
find -x $i -type f -atime +3 -exec rm -f -- {} \;
find -x $i \! -name . -type d -mtime +3 -exec rmdir \
--ignore-fail-on-non-empty -- {} \;
done
You could also check to see that a file is not in use, perhaps using
fstat or `fuser -s` or whatever.
More information about the plug
mailing list