LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-30-2003, 01:05 AM   #1
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 48
Question tmp folder question


would there be any danger in adding:

rm -Rvf /tmp/*

to my rc.local file, to clear out all the MBs of temp files at boot? if not, is there a better way to do it?
 
Old 08-30-2003, 07:08 AM   #2
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
The better way to do it is to make it a cron job. I think that cron has a daily script(/etc/cron.daily) that monitors the /tmp directory and deletes things as necessary. Of course, your systems setup could be different so you may not have anything like that.
 
Old 08-30-2003, 10:17 AM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
I do believe that Slackware already does this in its boot up scripts already. At least for some of the older releases, haven't checked 9.0 yet. Check your startup scripts as it might already remove everything in your /tmp folder at boot time.
 
Old 08-30-2003, 11:02 AM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
Quote:
The better way to do it is to make it a cron job
i dont agree, you shouldnt delete things from tmp in multi user mode as you dont know what people/programs have put there and you could be deleteing important stuff. the fhs states that /tmp is not required to survive a reboot so emptying the contents at boot is a perfectly good time to do it, but do it before all your daemons start up. i think the best solution is to mount /tmp as tmpfs and thus it resides in ram and gets cleared every reboot but this is not a good idea if you dont have a lot of memory.
 
Old 08-31-2003, 10:35 AM   #5
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Original Poster
Rep: Reputation: 48
thanks for the responses guys.

trickykid: i'm using slack 9, and it does not seem to be automatically removing the temp files.

crashed: i like the cron job idea, but i don't see any scripts in the cron folders to keep track of /tmp folder stuff. could you post what your script looks like if you have one?

kev82: i definitely don't want to mount /tmp into memory. how else could i clear it before the daemons start?

btw, i'm in no hurry with this, it's just something i'd like to find out about. if i come across a recommended solution in rute or somewhere, i'll post it.
 
Old 08-31-2003, 02:37 PM   #6
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
if you dont want /tmp in memory then go with your original idea. as i say its not really safe to remove the stuff with a cron job.
 
Old 08-31-2003, 02:43 PM   #7
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Original Poster
Rep: Reputation: 48
ok, thx.
 
Old 08-31-2003, 02:43 PM   #8
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Quote:
Originally posted by kev82
if you dont want /tmp in memory then go with your original idea. as i say its not really safe to remove the stuff with a cron job.
I agree but you could just delete files over 2 days old or something. This should give you the best of both.
 
Old 08-31-2003, 03:10 PM   #9
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Instead of during startup you could do it during shutdown... In that case you'd surely not have to worry about it messing with your daemon's or anything like that.

Cool
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TMP folder, is everything deletable in there? ginda Linux - Newbie 6 12-16-2006 01:43 PM
/var/tmp folder hardeep_ubhi Linux - General 4 10-02-2006 07:10 AM
What is all this junk in the /tmp folder? HoosTrax Linux - Newbie 2 02-10-2004 04:03 PM
How do I empty the /tmp folder at boot? Posty Slackware 13 10-12-2003 08:36 PM
Newbie question - /tmp /var/tmp Mr happy Linux - Security 3 01-27-2003 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:34 AM.

Main Menu
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