Clearing /var/tmp on boot

Garance A Drosihn drosih at rpi.edu
Tue Dec 29 02:34:14 UTC 2009


At 10:56 PM +0000 12/27/09, Pegasus Mc Cleaft wrote:
>
>	Should the /var/tmp directory be cleaned on bootup? To me, it
>looked like it should as many of the files in the KDE directory were
>partial download files many months old.

As others have already noted, you wouldn't want to blindly remove
everything in /var/tmp on reboot.

I've been saved several times by something left in /var/tmp, so I'd
be even a bit more paranoid about removing things than other people
have suggested.  I wouldn't remove things based on last-modification
time, since you may have some important backup files there which
have much older last-modification times.  You could also get royally
screwed up if you happen to have some kind of error with the time-
of-day clock.  (I've had machines which might boot up with the wrong
time after they had been powered off for awhile, or if rebooting
between OS's).

What I'd suggest is to create a sub-directory under /var/tmp using
some good naming convention based on the time of day at time of
reboot.  And then select files based on whatever criteria you want,
and MOVE them into the sub-directory that you've created.  Then at
some later time you could remove that sub-directory if you know
you've been up for awhile and you haven't had any need for any of
those files.

I realize this may seem like overkill, but every five or ten years
that extra step may save you from a lot of grief!

-- 
Garance Alistair Drosehn            =   gad at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-current mailing list