LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 11-09-2010, 08:13 AM   #1
2handband
Member
 
Registered: Jan 2009
Location: Alexandria, Minnesota
Distribution: Slackware 13.1
Posts: 809

Rep: Reputation: 96
Clearing /tmp at shutdown


I just realized that my /tmp directory is not being cleared at shutdown time. Can somebody tell me how to enable this? I'm running -current.
 
Old 11-09-2010, 08:24 AM   #2
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,380

Rep: Reputation: 180Reputation: 180
While its generally safe to manually clear /tmp, I've found that sometimes I really need something that may still be in /tmp. That said, it could be a month or more before I reboot, so I usually end up clearing things out myself.
 
Old 11-09-2010, 08:27 AM   #3
bnguyen
Member
 
Registered: Jul 2010
Distribution: Slackware
Posts: 125

Rep: Reputation: 32
Add this to /etc/rc.d/rc.local_shutdown

/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -rf
 
Old 11-09-2010, 08:40 AM   #4
2handband
Member
 
Registered: Jan 2009
Location: Alexandria, Minnesota
Distribution: Slackware 13.1
Posts: 809

Original Poster
Rep: Reputation: 96
Could you walk me through that command? I don't understand it...
 
Old 11-09-2010, 08:40 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,425

Rep: Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055
Just mount it as tmpfs - that way it'll clear itself.
 
Old 11-09-2010, 08:42 AM   #6
piratesmack
Member
 
Registered: Feb 2009
Distribution: Slackware, Arch
Posts: 518

Rep: Reputation: 133Reputation: 133
You can also add a line like this to /etc/fstab
Code:
tmpfs   /tmp   tmpfs   defaults   0 0
 
1 members found this post helpful.
Old 11-09-2010, 09:03 AM   #7
jkzfixme
Member
 
Registered: Sep 2006
Location: Orange County, NY
Distribution: Ubuntu, Solaris, Android
Posts: 329
Blog Entries: 21

Rep: Reputation: 52
or you could clear it on start up, so as to make sure that you did not need anything just add the following as a cron job

Quote:
@reboot rm -rf /tmp/*
Regards,
JKZfixme
 
Old 11-09-2010, 04:49 PM   #8
2handband
Member
 
Registered: Jan 2009
Location: Alexandria, Minnesota
Distribution: Slackware 13.1
Posts: 809

Original Poster
Rep: Reputation: 96
I went with pirate's suggestion and it works great. Thanks!
 
Old 11-09-2010, 05:14 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,425

Rep: Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055Reputation: 1055
Be aware this will eat memory (as in RAM) if used heavily. In a stress situation it will be subject to swap-out. All this is goodness IMHO, but if you happen to be one of those that follow the "swap is unneeded these days" mantra, you might be in for a surprise.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TRAC - something is clearing /tmp Lantzvillian Linux - Software 1 03-06-2010 09:49 AM
Can't login, says tmp directory full but tmp file is empty! Could be linked to MySQL? bethanlowder Fedora 7 09-25-2009 08:17 AM
how to securing /tmp , /var/tmp and /dev/shm hackintosh Linux - Security 7 10-18-2007 12:26 AM
automatically emptying /tmp at shutdown adityavpratap Slackware 13 01-31-2007 10:25 AM
[SOLVED] clearing /tmp at reboot sylye Debian 2 08-26-2006 05:42 AM


All times are GMT -5. The time now is 08:15 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration