Folder /tmp: what can be deleted?

I notice a growing number of folders in this directory (/tmp) that are empty. What restrictions or guidelines are there on deletion of any of the contents of this folder?

you can delete anything in there that’s not being used by a current running program.most of it should be automatically cleared out anyway,by a cron job run by the system daily

Andy

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

/tmp is just as described… temporary stuff. Worst-case scenario
there are settings in Yast (as I recall) that will delete all the
contents of /tmp on a reboot. Deleting everything in there at other
times could be a problem. I periodically, on my desktop which never
restarts, go in and delete stuff that’s over a month old. If you want
to reboot use a Knoppix disk, or just come up in runlevel 1 temporarily,
and nuke everything in there, then finish booting to runlevel 3/5/whatever.

Good luck.

XEyedBear wrote:
> I notice a growing number of folders in this directory (/tmp) that are
> empty. What restrictions or guidelines are there on deletion of any of
> the contents of this folder?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIr9hv3s42bA80+9kRAqWiAJ9FDWpzR5P6QaROGv2C8fhIO+vx1ACfTjQH
8WAzsi7HolGcY6qTMg3xMVs=
=EUCK
-----END PGP SIGNATURE-----

This doesn’t seem to happen on my system - there are a number of folders in there dating back to the time of my first installation of OpenSuSE in June. How do I check if the daily ‘cron job’ (?) is actually being run?

Hi
I’m sure cron would be running, but it’s dependant on whether you have
set the days either via YaST etc/sysconfig/editor (search on
MAX_DAYS_IN_TMP) or manually editing /etc/sysconfig/cron to enable
it (by default its disabled)


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.11-0.1-default
up 1 day 6:34, 3 users, load average: 0.28, 0.07, 0.09
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12

On Sun, 24 Aug 2008 22:37:55 GMT
Malcolm <malcolm_nospamlewis@bellsouth.net> wrote:

>

> Hi
> I’m sure cron would be running, but it’s dependant on whether you have
> set the days either via YaST etc/sysconfig/editor (search on
> MAX_DAYS_IN_TMP) or manually editing /etc/sysconfig/cron to enable
> it (by default its disabled)
>

As root, edit the file:

/etc/sysconfig/cron

Change some default values:

MAX_DAYS_IN_TMP=“3”

MAX_DAYS_IN_LONG_TMP=“3”

TMP_DIRS_TO_CLEAR=“/tmp”

LONG_TMP_DIRS_TO_CLEAR=“/var/tmp”

CLEAR_TMP_DIRS_AT_BOOTUP=“yes”

DAILY_TIME=“04:15”

MAX_NOT_RUN=“3”

Save the file. If you don’t do anything, the cron daemon will begin pruning
the older entries in /tmp, BUT it won’t delete anything owned by root, so
things build up.

The settings you changed above (read the comments in the file) cause the
system to wipe clean the /tmp and /var/tmp subdirectories on every boot.
Even root’s stuff.

This also prevents any nasty programs hiding anything in /tmp or /var/tmp for
use later.

Loni


L R Nix
lornix@lornix.com