LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Clearing /tmp at shutdown (http://www.linuxquestions.org/questions/slackware-14/clearing-tmp-at-shutdown-843207/)

2handband 11-09-2010 07:13 AM

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.

mlangdn 11-09-2010 07:24 AM

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.

bnguyen 11-09-2010 07:27 AM

Add this to /etc/rc.d/rc.local_shutdown

/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -rf

2handband 11-09-2010 07:40 AM

Could you walk me through that command? I don't understand it...

syg00 11-09-2010 07:40 AM

Just mount it as tmpfs - that way it'll clear itself.

piratesmack 11-09-2010 07:42 AM

You can also add a line like this to /etc/fstab
Code:

tmpfs  /tmp  tmpfs  defaults  0 0

jkzfixme 11-09-2010 08:03 AM

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

2handband 11-09-2010 03:49 PM

I went with pirate's suggestion and it works great. Thanks!

syg00 11-09-2010 04:14 PM

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.


All times are GMT -5. The time now is 06:39 AM.