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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-30-2003, 01:05 AM
|
#1
|
Senior Member
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020
Rep:
|
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?
|
|
|
08-30-2003, 07:08 AM
|
#2
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
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.
|
|
|
08-30-2003, 10:17 AM
|
#3
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
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.
|
|
|
08-30-2003, 11:02 AM
|
#4
|
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263
Rep:
|
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.
|
|
|
08-31-2003, 10:35 AM
|
#5
|
Senior Member
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020
Original Poster
Rep:
|
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.
|
|
|
08-31-2003, 02:37 PM
|
#6
|
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263
Rep:
|
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.
|
|
|
08-31-2003, 02:43 PM
|
#7
|
Senior Member
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020
Original Poster
Rep:
|
ok, thx.
|
|
|
08-31-2003, 02:43 PM
|
#8
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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.
|
|
|
08-31-2003, 03:10 PM
|
#9
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 12:34 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|