Can anybody recommend a "safe" strategy for tidying /usr/tmp?
Many Thanks,
=Adrian=
Many Thanks,
=Adrian=
If you want a tmp cleaner that's safe against accidental deletion of
files which are still in use, you shouldn't be using Unix...
Peter
A bit harsh I think. I have a /usr/tmp with 3057 files, with modificationQuote:> If you want a tmp cleaner that's safe against accidental deletion of
> files which are still in use, you shouldn't be using Unix...
Regards,
=Adrian=
See man find for more options like mtime.
Specifying files names within the command using:
- Ceri Davies
find /usr/tmp -atime +7 \( -name core -o -name '*.bak' \) -exec rm {} \;
> Safe against what? If you just want something safe against users
> playing games with symlinks, try 'tmpwatch' or 'tmpreaper'.
> If you want a tmp cleaner that's safe against accidental deletion of
> files which are still in use, you shouldn't be using Unix...
> Peter
>[...] I have a /usr/tmp with 3057 files, with modification
>dates ranging from today back to 1997!! Some of the files are nearly 1Mb,
>which all adds up. I don't think it in the least unreasonable to expect
>there to be a method of identifying "redundant" files in this directory.
For
>example: Is is safe to assume that all files created before the last boot
>can be deleted?
>Regards,
>?? =Adrian=
You should formulate a policy and post it; something like, each day we
delete all /usr/tmp files older than X. I'd say X=1 week is a reasonable
starting point for negotiations. For "older than" you could use modified
date or, if you wanted to be really nice, access date.
If you wanted to put more work into it, compare the last-modified times with
the last-accessed times for all the files in /usr/tmp and note any files
that are very old AND recently accessed. That means someone is keeping
read-only material of enduring interest in /usr/tmp.
Much as it grates on the sensibilites, you should probably do a one-time
archive of the directory tree before the first time you purge it. If you
don't, for sure you'll find out your VPs have been keeping their CVs there.
Chip
>> If you want a tmp cleaner that's safe against accidental deletion of
>> files which are still in use, you shouldn't be using Unix...
>A bit harsh I think. I have a /usr/tmp with 3057 files, with modification
>dates ranging from today back to 1997!! Some of the files are nearly 1Mb,
>which all adds up. I don't think it in the least unreasonable to expect
>there to be a method of identifying "redundant" files in this directory. For
>example: Is is safe to assume that all files created before the last boot
>can be deleted?
Users, on the other hand, may wish to continue using files from before
the last reboot. Consider what happens if somebody uses /usr/tmp to
store a database consisting of multiple files. (Call it "netscape-cache"
for the sake of argument.) Some files will be more recent than others,
but if you delete one of files, you should delete all of them to avoid
leaving behind an inconsistent database.
How do you know when a user has genuinely finished with a file? Unix
doesn't have any way for a user to declare how long they want a
temporary file for.
And it's not that uncommon for users to request /tmp files from backups...
Peter
Apart the System/dba administrators, "users" do not have access to a unixQuote:> Users, on the other hand, may wish to continue using files from before
> the last reboot. Consider what happens if somebody uses /usr/tmp to
> store a database consisting of multiple files. (Call it "netscape-cache"
> for the sake of argument.) Some files will be more recent than others,
> but if you delete one of files, you should delete all of them to avoid
> leaving behind an inconsistent database.
> How do you know when a user has genuinely finished with a file? Unix
> doesn't have any way for a user to declare how long they want a
> temporary file for.
Not on our systems!!Quote:> And it's not that uncommon for users to request /tmp files from backups...
Regards,
=Adrian=
>However the intended purpose /usr/tmp is not clear to me, I
>can find no reference to it in my copies of the Adminstration guide.
Given that the above filename is 'random', you can safely assume thatQuote:>All files a names similar to "AAAzynZm_.TMP" Hence my question.
Looking at the file's contents or using fuser might tell you what
created it. Good applications will clean up temporary files after
themselves; accumulation of files might indicate something going
wrong, or it could just be sloppy programming.
Peter
What do you tell them when they ask? "There's no tmpfsdump program, sorry"? ...Quote:>And it's not that uncommon for users to request /tmp files from backups...
Chris Thompson
Email: cet1 [at] cam.ac.uk
1. /tmp vs /usr/tmp vs /var/tmp
:Please help me understand temp directories. I know what /tmp is for,
:and I know that /var/tmp is like /tmp only it is not normally cleared
:at boot-time. But then what is /usr/tmp for? or aren't /usr/tmp and
:/var/tmp usually used in the same implementation?
/usr/tmp and /var aren't normally in the same implementation.
--
InterNIC WHOIS: MJO | (has my PGP & Geek Code info) | Phone: +1 248-848-4481
2. 40M ram, but only 27M usable without swap??? (solaris 2.3)
3. UNIX QUESTION: how to redefine /tmp and /usr/tmp ?
4. CD ROM problem with Rehat 4.2
7. RH 9 Upgrading: /usr/tmp symlink Error
8. any upcoming solaris user/dev/admin conferences ?
9. /usr/bin/shutdown: /tmp/sh700: Creation not possible ?
10. A separate /usr/tmp for a diskless client?
11. Mosaic and ATK help need /usr/tmp
13. OSE5 sendmail - lmail leaves files in /usr/tmp