[comp.unix.questions] cleaning up /tmp

perry@ccssrv.UUCP (Perry Hutchison) (11/11/89)

In article <20551@unix.cis.pitt.edu> yahoo@unix.cis.pitt.edu (Kenneth L Moore)
writes:

>This should be addressed by the systems people. I would think that a
>program to clean /tmp on an as needed basis would be appropriate.

>I have logged in a week after writing to /tmp and found files still there.

SunOS, and probably others, clean /tmp on a reboot.  That is the only time
when a complete cleanout is known to be safe without a lot of checking.

It is certainly possible, and probably advisable, to have a script which
removes anything in /tmp which has not been {accessed|modified} (pick one)
in, say, a week.  Such a script can be run by cron in the wee hours.

Before you ask the obvious followup questions, read the man pages for find(1)
and cron(8).

ecl@cbnewsj.ATT.COM (Evelyn C. Leeper) (11/13/89)

In article <815@ccssrv.UUCP> perry@ccssrv.UUCP (Perry Hutchison) writes:
> In article <20551@unix.cis.pitt.edu> yahoo@unix.cis.pitt.edu (Kenneth L Moore)
> writes:
> >This should be addressed by the systems people. I would think that a
> >program to clean /tmp on an as needed basis would be appropriate.
> It is certainly possible, and probably advisable, to have a script which
> removes anything in /tmp which has not been {accessed|modified} (pick one)
> in, say, a week.  Such a script can be run by cron in the wee hours.

/tmp is for temporary files, such as those created by compilers and so on as
interim steps.  It is not for people to throw all sorts of stuff in for someone
else to figure out how to clean up.

Of course, cleaning /tmp is advisable, but we've found that files can't hang
around a week before /tmp gets full--we give them 24 hours and then out.  It
would be nice to give them longer but disk space (even /tmp) is not free and
too many people write programs that create *huge* files in /tmp and then don't
remove them on exiting.  (We're talking 4-megabyte files here, folks!)  In
fact, on some systems, six hours is the best people can expect before files are
jettisoned.

If people started using /tmp as a temporary wastebasket in addition, it would
end up that files would get cleaned out after an hour or two (and yes, there
are ways to do that!).  Even so, I suspect many programs would start failing
for lack of space.  People who want to tie up space should do it in their home
directories where they will inconvenience only the people in their filesystem,
where they will be charged for the space, and from which they can clean up with
a script such as:
	find $WASTEBASKET -atime +2 -print | xargs rm -f 2>/dev/null
in their .profile or personal crontab (if such a feature is offered on their
system).  As a system administrator, I'm tired of having to find new and
innovative ways to clean up after the new and innovative ways people have for
eating up common disk space.

On the other hand, they may leave their laundry lying around their house for
someone else to pick up after as well....

Evelyn C. Leeper  |  +1 201-957-2070  |  att!mtgzy!ecl or  ecl@mtgzy.att.com
--
If I am not for myself, who is for me?  If I am only for myself what am I?
And if not now, when?  --Hillel

jeffm@uokmax.ecn.uoknor.edu (Jeff Medcalf) (11/13/89)

I have a number of shell scripts and aliases which I use to preserve what I
remove, unremove things, list what is removed, and clean the trashcan.

On our system, /tmp is used as outlined in the referenced article, and
/var/tmp is the users' temporary space.

Files and directories in /var/tmp which do not begin with a . are removed on
reboots (once every day or two), and files and directories that *do* begin
with a . are subject to removal at any time.  We have no problem with the
/var/tmp directory overflowing, even though several people use directories
of the form /var/tmp/.username


-- 
Jeff Medcalf	 jeffm@uokmax.uucp	jeffm@uokmax.ecn.uoknor.edu
!chinet!uokmax!jeffm	jeffm@invent_an_address (as reliable as the preceeding)
In 1869, the waffle iron was invented, thus solving the annoying tendency of
waffles to wrinkle in the dryer.

davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (11/14/89)

  My nightclean script does some other cleanup, like uucp logs, etc. It
also gets rid of any file over three days old named *.tmp or *.out (or
core). This allows users to create files and be sure that they won't run
out of disk if they forget to clean up.

-- 
bill davidsen	(davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon