LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 12-02-2009, 10:22 AM   #1
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Rep: Reputation: 94
/tmp directory...


Hi Forum

Everytime in run a slackbuild, or src2pkg, besider of creating the install package in /tmp, it creates several folders... some in /tmp/SBo/* ans some others in /tmp/*.

Of course I pan to burn a DVD with the whole set of packages for install/up(downgrade) I have created... I won't wipe them until I have done so...

My question is...

Should i rm -rf all the directories created in /tmp, could this harm my system...?

( Guess no, but one never knows... :-| )

BRGDS

Alex
 
Old 12-02-2009, 10:29 AM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
/tmp is just what it says, temporary. Many distributions clear it at boot time too. As long as you don't delete a file in active use (eg while the package is installing or something similar) you should be ok to delete anything in /tmp.
 
1 members found this post helpful.
Old 12-02-2009, 10:32 AM   #3
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Original Poster
Rep: Reputation: 94
Hi rweaver

Thks for your answer...

...as time goes by, /tmp gets really big :-)

...I'll post someting in /etc/rc.local like rm -rf /tmp/*&

so as not to worry with this anymore...

Thx

BRGDS

Alex
 
Old 12-02-2009, 01:46 PM   #4
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
some in /tmp/SBo/*
I always modify slackbuild scripts to delete the two directories each script creates.

Regarding the remainder of the /tmp directory, perhaps the following will help:

Removing Temporary Files and Clutter

There are two short shell scripts there that might help you write your own script.

Another trick I use is to assign the $TMP environment variable to /dev/shm, which is created in /etc/fstab. Because that location is in RAM, all of the possible clutter created in $TMP gets deleted with a reboot or shutdown.
 
1 members found this post helpful.
Old 12-02-2009, 01:49 PM   #5
adriv
Member
 
Registered: Nov 2005
Location: Diessen, The Netherlands
Distribution: Slackware 15
Posts: 700

Rep: Reputation: 43
Create a file in /etc/rc.d/ called rc.local_shutdown, put this line in it and make it executable (chmod +x):
Code:
/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -fr
That way, /tmp will be cleared during shutdown.
Never caused me any trouble.
 
2 members found this post helpful.
Old 12-02-2009, 02:04 PM   #6
Ivshti
Member
 
Registered: Sep 2008
Distribution: Linvo
Posts: 132

Rep: Reputation: 43
You can safely delete everything in it. Move your packages to another directory. If you have enough RAM, you can mount /tmp as tmpfs, and your system will be a lot faster, but the info in /tmp will be lost at reboot, which isn't a problem anyway.
 
1 members found this post helpful.
Old 12-02-2009, 02:15 PM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by adriv View Post
Create a file in /etc/rc.d/ called rc.local_shutdown, put this line in it and make it executable (chmod +x):
Code:
/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -fr
That way, /tmp will be cleared during shutdown.
Never caused me any trouble.
Ah! A perennial question and one for which there are no right answers -- only options with pros and cons.

It is arguably safer to clear /tmp during startup as soon as the file system containing it is mounted (or is mounted rw, if it is on /) because that is the time when there is least likelihood of active processes accessing files on /tmp. There is still a possibility that some files-or-directories in /tmp are required, especially if /tmp is the root of a file system -- in which case it will have lost+found and maybe quota system files.

Following this concept, and having /tmp on /, I modified /etc/rc.d/rc.S (on Slackware 13.0 32-bit) as detailed in this LQ post. Beware! This was controversial in later posts in the same thread including "You should not give advice that will break others's systems". Some illuminating debate ensued but not all the issues raised were fully answered.
 
1 members found this post helpful.
Old 12-02-2009, 04:16 PM   #8
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
I think the best answer potentially has two parts.

1) Regardless of whether you have "enough" ram, put /tmp on a tmpfs. Problem solved.
The tmpfs will use 1/2 of the available ram by default (iirc), but if it's not being used by files, it can still be used by system as memory.

2) Set TMP=/somewhere_else and OUTPUT=/somewhere_else_else in your environment when running the build scripts.
Then, when you're done, you can wipe $TMP completely with no issues at all, and your packages will be left in $OUTPUT.
 
1 members found this post helpful.
Old 12-02-2009, 10:53 PM   #9
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 111Reputation: 111
@rworkman thanks for pointing out how tmpfs works.

I'm wondering if a cron job would be a wise idea in that situation if it deleted any file older than a day/hour/what ever.
 
1 members found this post helpful.
Old 12-02-2009, 11:01 PM   #10
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by lumak View Post
I'm wondering if a cron job would be a wise idea in that situation if it deleted any file older than a day/hour/what ever.
Not blindly, no. At least in my case, that would wipe my gpg-agent and my ssh-agent directories from /tmp, as they're created when I log in, and I stay logged in for days or even weeks at a time.
 
1 members found this post helpful.
Old 12-03-2009, 12:36 AM   #11
Hannes Worst
Member
 
Registered: Jul 2008
Location: Tilburg, The Netherlands
Distribution: Void Linux, Slackware, Nixos
Posts: 179

Rep: Reputation: 122Reputation: 122
I have created a line in my /etc/fstab like this:
tmpfs /tmp tmpfs mode=1777 0 0
Now /tmp is cleaned everytime I exit my computer. Works great for me so far.
 
1 members found this post helpful.
Old 12-03-2009, 01:59 AM   #12
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by lumak View Post
I'm wondering if a cron job would be a wise idea in that situation if it deleted any file older than a day/hour/what ever.
See the thread I linked above; it has some useful discussion related to your wondering, including about tmpwatch which is designed for tmp file housekeeping.
 
1 members found this post helpful.
Old 12-03-2009, 07:00 AM   #13
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by Alexvader View Post
Everytime in run a slackbuild, or src2pkg, besider of creating the install package in /tmp, it creates several folders... some in /tmp/SBo/* ans some others in /tmp/*.
I always just delete everything in /tmp/SBo/ after I install my slackbuilds.
Quote:
Originally Posted by Alexvader View Post
Of course I pan to burn a DVD with the whole set of packages for install/up(downgrade) I have created... I won't wipe them until I have done so...
I save all my slackbuild packages in a "slackbuilds" directory in my home directory. This way I can easily reinstall them all if I ever reinstall Slackware. I have never need to reinstall Slackware though.
I can also easily move them to my laptop if I need them there.

Last edited by tommcd; 12-03-2009 at 07:02 AM.
 
1 members found this post helpful.
Old 12-03-2009, 07:04 AM   #14
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Original Poster
Rep: Reputation: 94
Hi ppl

Thks for all your enlightening answers... :-)


BRGDS

Alex
 
  


Reply



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
Can't login, says tmp directory full but tmp file is empty! Could be linked to MySQL? bethanlowder Fedora 7 09-25-2009 07:17 AM
/TMP Directory carlosinfl Linux - General 4 01-23-2007 01:02 PM
/tmp directory is full? Moses420ca Linux - Newbie 13 01-21-2005 07:48 PM
permissions in /tmp directory linux_pioneer Linux - Software 1 08-30-2003 10:43 PM
/tmp directory Bobmeister Linux - General 3 06-01-2003 04:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:40 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