Next | Prev | Up | Top | Contents | Index

Cleaning Out Temporary Directories

The directory /tmp and all of its subdirectories are automatically cleaned out every time the system is rebooted. You can control whether or not this happens with the chkconfig option nocleantmp. By default, nocleantmp is off, and thus /tmp is cleaned.

The directory /var/tmp is not automatically cleaned out when the system is rebooted. This is a fairly standard practice on IRIX systems. If you wish, you can configure IRIX to automatically clean out /var/tmp whenever the system is rebooted. Changing this standard policy is a fairly extreme measure, and many people expect that files left in /var/tmp are not removed when the system is rebooted. Do not make this change without warning users well in advance.

If you must change the policy, this is how to do it:

  1. Notify everyone who uses the system that you are changing the standard policy regarding /var/tmp, and that all files left in /var/tmp will be removed when the system is rebooted. Send electronic mail and post a message in the /etc/motd file.

    Give the users at least one week's notice, longer if possible.

  2. Copy the file /etc/init.d/rmtmpfiles to a new file in the same directory, for example, /etc/init.d/rmtmpfiles2:

    # cd /etc/init.d

    # cp rmtmpfiles rmptmpfiles2

  3. Open rmtmpfiles2 for editing, for example:

    # vi rmtmpfiles2

  4. Find a block of commands in the file that looks something like this:

    # make /var/tmp exist

    if [ ! -d /var/tmp ]

    then

    rm -f /var/tmp # remove the directory

    mkdir /var/tmp

    fi

  5. Before the fi statement add the following lines:

    else

    # clean out /var/tmp

    rm -f /var/tmp/*

    The complete block of commands should look something like this:

    # make /var/tmp exist

    if [ ! -d /var/tmp ]

    then

    rm -f /var/tmp # remove the directory

    mkdir /var/tmp

    else

    # clean out /var/tmp

    rm -f /var/tmp/*

    fi

  6. Save the file and exit the editor.

  7. Create a link to the new file in the directory /etc/rc2.d, following the naming conventions described in /etc/init.d/README. For example:

    # cd ../rc2.d

    # ln -s ../init.d/rmtmpfiles S59rmtmpfiles2


Next | Prev | Up | Top | Contents | Index