Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is it safe to clean /tmp before shutdown ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
garo
Bodhisattva
Bodhisattva


Joined: 15 Jul 2002
Posts: 860
Location: Edegem,BELGIUM

PostPosted: Sat Jan 18, 2003 1:10 pm    Post subject: Is it safe to clean /tmp before shutdown ? Reply with quote

I was thinking of putting the following in my "/etc/conf.d/local.stop" :

Code:
rm -rf /tmp/*


Or is it better to put this in "/etc/conf.d/local.start", or maybe i could execute it every week with cron, or maybe i should never clean it, or maybe someone has a better idea ?
_________________
My favorite links this month:
- Surf Random
- Web-based SSH
- Stop Spam
Back to top
View user's profile Send private message
NiklasH
Apprentice
Apprentice


Joined: 30 Aug 2002
Posts: 211
Location: On top of something

PostPosted: Sat Jan 18, 2003 1:39 pm    Post subject: Reply with quote

I don't think a cron job would be very good, since you might have some large build going overnight, which could be broken if its files suddenly are wiped in the middle of the build. I'd vote for local.stop, since it's less annoying than having to wait for /tmp to clean up when you boot your computer. (Although I'd imagine that it wouldn't take that long, either)
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Sat Jan 18, 2003 1:48 pm    Post subject: Reply with quote

You can also emerge tmpwatch with ACCEPT_KEYWORDS=~x86 and then run it from cron.daily (RedHat does this to clean out temp. directories). This has the advantage of working even if you don't reboot very often.
Back to top
View user's profile Send private message
garo
Bodhisattva
Bodhisattva


Joined: 15 Jul 2002
Posts: 860
Location: Edegem,BELGIUM

PostPosted: Sat Jan 18, 2003 2:06 pm    Post subject: Reply with quote

Quote:
You can also emerge tmpwatch


Won't tmpwatch also delete tmp files that are still necessary and is this exploit fixed ?

Quote:
I'd vote for local.stop


I was planning to do this, but i am not really sure if the shutdown proces doesn't need some tmp files...
_________________
My favorite links this month:
- Surf Random
- Web-based SSH
- Stop Spam
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Sat Jan 18, 2003 2:32 pm    Post subject: Reply with quote

Looks like the exploit is fixed. You can use it with the -s option to avoid deleting opened files. It also have a time setting that checks for access time before blowing away something. This works fine in practice.
garo wrote:
Quote:
You can also emerge tmpwatch


Won't tmpwatch also delete tmp files that are still necessary and is this exploit fixed ?

Quote:
I'd vote for local.stop


I was planning to do this, but i am not really sure if the shutdown proces doesn't need some tmp files...
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Sat Jan 18, 2003 3:58 pm    Post subject: Reply with quote

There may be others like this though.

local.stop is called before all other services are stopped. So, it is not absolutely guaranteed that /tmp would not be used at this point. You can fire off tmpwatch from local.stop with a access time setting of 0 and a "-s" option (you would need to make a symlink from /usr/bin/fuser to /sbin/fuser for -s to work); this will avoid killing files that are open. You can also cook up a homebrew solution using lsof/fuser in local.stop if you don't like tmpwatch.
Naan Yaar wrote:
Looks like the exploit is fixed.
Back to top
View user's profile Send private message
Aiken
Apprentice
Apprentice


Joined: 22 Jan 2003
Posts: 239
Location: Toowoomba/Australia

PostPosted: Wed Jan 22, 2003 11:34 pm    Post subject: Reply with quote

If I clean out /tmp with a script I do it early in the boot process. Try to get it clean before processes start putting their files in /tmp. (X, xfs, kde + others).

If it is just to keep the size of /tmp down I have found tmpwatch to be quite good. On the machine that I use tmpwatch on I have it deleting any files that have not been used after 24 hours.

On my machine I have /tmp mount as tmpfs. This way it is a ram disk and /tmp clean every time I boot. I got sick of X or kde not starting because of stale lock files or temporary files in /tmp. Having /tmp as a ram disk works very nicely for me.
Back to top
View user's profile Send private message
dreamer3
Guru
Guru


Joined: 24 Sep 2002
Posts: 553

PostPosted: Thu Feb 06, 2003 6:54 am    Post subject: Reply with quote

Aiken wrote:
On my machine I have /tmp mount as tmpfs. This way it is a ram disk and /tmp clean every time I boot. I got sick of X or kde not starting because of stale lock files or temporary files in /tmp. Having /tmp as a ram disk works very nicely for me.

Amen to that.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum