LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > arniekat
User Name
Password

Notices


Rate this Entry

Slackware-13.1-Hacks-Emptying tmp

Posted 01-01-2011 at 10:09 PM by arniekat

# This will empty the /tmp folder when you shutdown or
# reboot the machine
# Add this line to /etc/rc.d/rc.6

echo "Emptying /tmp"
rm /tmp/* -rf &1>2 > /dev/null

The /dev/null part gets rid of any output/error codes.

I placed it between the following sections in /etc/rc.d/rc.6

# Save the system time to the hardware clock using hwclock --systohc.
if [ -x /sbin/hwclock ]; then
# Check for a broken motherboard RTC clock (where ioports for rtc are
# unknown) to prevent hwclock causing a hang:
if ! grep -q -w rtc /proc/ioports ; then
CLOCK_OPT="--directisa"
fi
if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
echo "Saving system time to the hardware clock (UTC)."
/sbin/hwclock $CLOCK_OPT --utc --systohc
else
echo "Saving system time to the hardware clock (localtime)."
/sbin/hwclock $CLOCK_OPT --localtime --systohc
fi
fi

# Clean out the /tmp directory
echo "Emptying /tmp"
rm /tmp/* -rf &1>2 > /dev/null

# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
/etc/rc.d/rc.local_shutdown stop
fi
Posted in Uncategorized
Views 1294 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    If you have enough ram, it's equally effective to have a ram filesystem mounted to /tmp.
    Posted 01-01-2011 at 10:53 PM by lumak lumak is offline
 

  



All times are GMT -5. The time now is 05:21 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration