tmp files dumping

This is a discussion on tmp files dumping within the Linux General forums, part of the Linux Forums category; Bill Unruh writes: > For example put in an entry into roots crontab which says > 0 4 1 1-...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 03-24-2006
John Hasler
 
Posts: n/a
Default Re: tmp files dumping

Bill Unruh writes:
> For example put in an entry into roots crontab which says


> 0 4 1 1-12/1 * find /root/tmp -mtime +30 rm \{\} \; which would delete
> all items older than 30 days old from /root/tmp at 4AM on the first day
> of each month.


Or put a similar command in /etc/bash_logout.
--
John Hasler
john@dhh.gt.org
Dancing Horse Hill
Elmwood, WI USA
Reply With Quote
  #12 (permalink)  
Old 03-24-2006
Aragorn
 
Posts: n/a
Default Re: tmp files dumping

On Friday 24 March 2006 17:25, CWO4 Dave Mann stood up and spoke the
following words to the masses in /comp.os.linux.misc...:/

> [...] I find that I have several directories named /tmp.
>
> /root/tmp


This would be the private *~/tmp* of the root user - as others have told
you. You'll need to clean this out manually, and I would suggest even
removing it.

The *~/tmp* directories are intended to store sockets - via symlinks to
*/tmp* - and the root user should _*never*_ do such a thing as firing
up a browser, et al.

> /usr/dave/tmp


Are you sure you're on GNU/Linux? User homes are stored under */home*
in GNU/Linux. Other than that, the same applies as above; it is a
personal directory which you need to manually clean out.

On the other hand, those directories normally only contain symbolic
links to sockets, which are really stored in */tmp.*

> /usr/dave/.tmp


This could be a directory that one specific application created. I
don't see what distribution would create such a directory by default.

> /var/.tmp


That should be */var/tmp,* and its contents may need to be preserved
across reboots - unlike the contents of */tmp.* You should normally
also have a */usr/tmp,* but this should be a symbolic link to
*/var/tmp.*

> I don't have a clue, otherwise. I know I never set them up. A couple
> of years ago (discussion here I think) I looked into putting the /tmp
> directory on a ram drive.


Put something in */etc/fstab* like...:

none /tmp tmpfs nodev,noexec,nosuid,size=200m 0 0

Adjust the size to your liking. ;-)

> The not being emptied situation has to be corrected. I am
> parsimonious with my HD space, even though I have close to a TB of
> space on several drives. The cumulative total of all the /tmp
> directories is almost 3 GB.


If you leave the contents */tmp* on the physical disk as opposed to
using /tmpfs,/ you should use have it mounted with /atime/ and you
should have /tmpwatch/ or something similar set up to clean out files
no longer in use.

As said, */var/tmp* may contain files that may need to survive a reboot,
but there again /tmpwatch/ could prove useful.

As for all */home/$USER/tmp* files, your distribution should normally
set those up so that their contents are only symlinks to sockets that
physically are in */tmp.* There should not be any *.tmp* directories
anywhere.

Lastly, as for */root/tmp,* I would suggest that you erase the entire
directory. It shouldn't be there, and you shouldn't take the name of
root in vain... ;-)

--
With kind regards,

*Aragorn*
(Registered GNU/Linux user #223157)
Reply With Quote
  #13 (permalink)  
Old 03-25-2006
Robert Hull
 
Posts: n/a
Default Re: tmp files dumping

In comp.os.linux.misc, on Fri 24 March 2006 20:16, Unruh
<unruh-spam@physics.ubc.ca> wrote:

> Robert Hull <Robert@please.do-not-spam.me.uk> writes:
>
>>In comp.os.linux.misc, on Fri 24 March 2006 16:01, Jeremiah DeWitt
>>Weiner <jdw@panix.com> wrote:

>
>>> CWO4 Dave Mann <misterfixit@loveable.com> wrote:
>>>
>>>> Hey Group, I was snooping around my system just now and looked in
>>>> the /root/tmp folder. There is stuff in there from months ago.
>>>> When does it ever get emptied?

[snip]
>>> Personally, I think 'at reboot' is the best way to do it, but
>>> reasonable people can and do disagree.
>>>

>>But some people want to empty /tmp more than every three years

>
> That is what cron is for.


Using cron is indeed a better solution that emptying ~/tmp at reboot -
which is the point to which my previous comment referred.

Just for the avoidance of doubt, the full sentence implied by my comment
above would have been:

"But some people want to empty ~/tmp more than every three years
which is how long they would have to wait were they to adopt
your suggestion of only emptying it at reboot time"

I hope this helps you to understand my point this time.
--
Robert HULL

Archival or publication of this article on any part of thisishull.net
is without consent and is in direct breach of the Data Protection Act
Reply With Quote
  #14 (permalink)  
Old 03-25-2006
Robert Hull
 
Posts: n/a
Default Re: tmp files dumping

In comp.os.linux.misc, on Fri 24 March 2006 20:51, John Hasler
<john@dhh.gt.org> wrote:

> Bill Unruh writes:
>> For example put in an entry into roots crontab which says

>
>> 0 4 1 1-12/1 * find /root/tmp -mtime +30 rm \{\} \; which would
>> delete all items older than 30 days old from /root/tmp at 4AM on the
>> first day of each month.

>
> Or put a similar command in /etc/bash_logout.


Putting the command in /etc/bash/logout would probably not make it
execute very frequently since it would need to wait until the user
logged out.

Personally, I tend to log out less frequently than I reboot - simply
because my last two reboots were courtesy of the Electricity company.
--
Robert HULL

Archival or publication of this article on any part of thisishull.net
is without consent and is in direct breach of the Data Protection Act
Reply With Quote
  #15 (permalink)  
Old 03-25-2006
John Hasler
 
Posts: n/a
Default Re: tmp files dumping

Robert Hull writes:
> Putting the command in /etc/bash/logout would probably not make it
> execute very frequently since it would need to wait until the user logged
> out.


Something most users do (BTW that's /etc/bash_logout).

> Personally, I tend to log out less frequently than I reboot - simply
> because my last two reboots were courtesy of the Electricity company.


You and I are not typical users.
--
John Hasler
john@dhh.gt.org
Dancing Horse Hill
Elmwood, WI USA
Reply With Quote
  #16 (permalink)  
Old 03-25-2006
CWO4 Dave Mann
 
Posts: n/a
Default Re: tmp files dumping

Robert Hull wrote:

> In comp.os.linux.misc, on Fri 24 March 2006 20:16, Unruh
> <unruh-spam@physics.ubc.ca> wrote:
>
>> Robert Hull <Robert@please.do-not-spam.me.uk> writes:
>>
>>>In comp.os.linux.misc, on Fri 24 March 2006 16:01, Jeremiah DeWitt
>>>Weiner <jdw@panix.com> wrote:

>>
>>>> CWO4 Dave Mann <misterfixit@loveable.com> wrote:
>>>>
>>>>> Hey Group, I was snooping around my system just now and looked in
>>>>> the /root/tmp folder. There is stuff in there from months ago.
>>>>> When does it ever get emptied?

> [snip]
>>>> Personally, I think 'at reboot' is the best way to do it, but
>>>> reasonable people can and do disagree.
>>>>
>>>But some people want to empty /tmp more than every three years

>>
>> That is what cron is for.

>
> Using cron is indeed a better solution that emptying ~/tmp at reboot -
> which is the point to which my previous comment referred.
>
> Just for the avoidance of doubt, the full sentence implied by my comment
> above would have been:
>
> "But some people want to empty ~/tmp more than every three years
> which is how long they would have to wait were they to adopt
> your suggestion of only emptying it at reboot time"
>
> I hope this helps you to understand my point this time.




I'm clear on the various recommendations. And I thank you all for them
too!. My system runs with an UPS so the only time I reboot is
when I want to do so, which isn't that often. I found that after I did an
rm on the /usr/tmp kde began to complain that it could not find links or
something. Sorry I am being vague, but it was the same message I used to
get when I had the tmp running on a ram drive.

I am being overly concerned, I think. My system is 2x200GB HD's and 3x200GB
Firewires. So I have plenty of space for tmp files. I am still thinking
like I used to think when I had my Heathkit H89.

Thanks you all for the info ... I got educated!

Cheers,

Dave




~~~~~~~~~~~~~~~~~~~~~~~~
Study History - Know the Future
Reply With Quote
  #17 (permalink)  
Old 03-25-2006
Aragorn
 
Posts: n/a
Default Re: tmp files dumping

On Saturday 25 March 2006 04:15, CWO4 Dave Mann stood up and spoke the
following words to the masses in /comp.os.linux.misc...:/

>> [...]

>
> I'm clear on the various recommendations. And I thank you all for
> them too!. My system runs with an UPS so the only time I reboot is
> when I want to do so, which isn't that often.


The measure of cleaning out */tmp* on boot is rather to be considered
"useful" than as "the way to do it".

The best advice is to install something called /tmpwatch/ - other
similar software exists - and to have */tmp* and */var/tmp* mounted
with the /atime/ option. This allows the system to keep track of the
last time a file or directory was accessed.

/tmpwatch/ can then be set up to delete files from those two directories
when they haven't been accessed for longer than - say - a day or two.

Furthermore, you could use /cron/ to set up a script to do a similar
thing on the files in your */home/$USER/tmp* - but this too would
require mounting */home* with /atime/ enabled - or you could put a...

rm -rf ~/tmp/*

.... in your */home/$USER/.bash_logout. You could even add that to
*/etc/skel/.bash_logout* so that it applies to every newly created user
account.

> I found that after I did an rm on the /usr/tmp kde began to complain
> that it could not find links or something.


*/usr/tmp* should be a symbolic link to */var/tmp.* */usr* is an
otherwise static filesystem and should remain so. On my system, */usr*
is mounted read-only, even.

The symlink to */var/tmp* then makes it possible to write to */usr/tmp*
for those archaic programs that still want to do that. ;-)

> Sorry I am being vague, but it was the same message I used
> to get when I had the tmp running on a ram drive.


As long as you're running KDE or something similar, there will be files
in */tmp* that need access. Also bear in mind that for safety's sake,
you should set */tmp* and */var/tmp* up with the sticky bit set.

> I am being overly concerned, I think. My system is 2x200GB HD's and
> 3x200GB Firewires. So I have plenty of space for tmp files.


On a normal UNIX workstation with one user account, about 100 MB of
space for */tmp* should be more than enough.

--
With kind regards,

*Aragorn*
(Registered GNU/Linux user #223157)
Reply With Quote
  #18 (permalink)  
Old 03-25-2006
CWO4 Dave Mann
 
Posts: n/a
Default Re: tmp files dumping

Aragorn wrote:

> On Saturday 25 March 2006 04:15, CWO4 Dave Mann stood up and spoke the
> following words to the masses in /comp.os.linux.misc...:/
>
>>> [...]

>>
>> I'm clear on the various recommendations. And I thank you all for
>> them too!. My system runs with an UPS so the only time I reboot is
>> when I want to do so, which isn't that often.

>
> The measure of cleaning out */tmp* on boot is rather to be considered
> "useful" than as "the way to do it".
>
> The best advice is to install something called /tmpwatch/ - other
> similar software exists - and to have */tmp* and */var/tmp* mounted
> with the /atime/ option. This allows the system to keep track of the
> last time a file or directory was accessed.
>
> /tmpwatch/ can then be set up to delete files from those two directories
> when they haven't been accessed for longer than - say - a day or two.
>
> Furthermore, you could use /cron/ to set up a script to do a similar
> thing on the files in your */home/$USER/tmp* - but this too would
> require mounting */home* with /atime/ enabled - or you could put a...
>
> rm -rf ~/tmp/*
>
> ... in your */home/$USER/.bash_logout. You could even add that to
> */etc/skel/.bash_logout* so that it applies to every newly created user
> account.
>
>> I found that after I did an rm on the /usr/tmp kde began to complain
>> that it could not find links or something.

>
> */usr/tmp* should be a symbolic link to */var/tmp.* */usr* is an
> otherwise static filesystem and should remain so. On my system, */usr*
> is mounted read-only, even.
>
> The symlink to */var/tmp* then makes it possible to write to */usr/tmp*
> for those archaic programs that still want to do that. ;-)
>
>> Sorry I am being vague, but it was the same message I used
>> to get when I had the tmp running on a ram drive.

>
> As long as you're running KDE or something similar, there will be files
> in */tmp* that need access. Also bear in mind that for safety's sake,
> you should set */tmp* and */var/tmp* up with the sticky bit set.
>
>> I am being overly concerned, I think. My system is 2x200GB HD's and
>> 3x200GB Firewires. So I have plenty of space for tmp files.

>
> On a normal UNIX workstation with one user account, about 100 MB of
> space for */tmp* should be more than enough.
>


Thank you Aragorn! I apprecaite the infos ... alles klar !

Cheers,

Dave




~~~~~~~~~~~~~~~~~~~~~~~~
Study History - Know the Future
Reply With Quote
  #19 (permalink)  
Old 03-25-2006
The Natural Philosopher
 
Posts: n/a
Default Re: tmp files dumping

CWO4 Dave Mann wrote:
> Jeremiah DeWitt Weiner wrote:
>
>> CWO4 Dave Mann <misterfixit@loveable.com> wrote:
>>
>>> Hey Group, I was snooping around my system just now and looked in
>>> the /root/tmp folder. There is stuff in there from months ago. When
>>> does it ever get emptied?

>> I never heard of a /root/tmp directory (not "folder"), although
>> there's nothing impossible about it. /tmp is standard; /root/tmp is
>> not. There are about three ways/times in which temp directories get
>> emptied, other than doing it manually:
>> 1. Never.
>> 2. At reboot.
>> 3. When something like 'tmpreaper' gets run on a schedule.
>>
>> Exactly which of these might apply depends on your distribution.
>> Personally, I think 'at reboot' is the best way to do it, but reasonable
>> people can and do disagree.
>>

>
>
>
> Thanks for the insight. I find that I have several directories named /tmp.
>
> /root/tmp
> /usr/dave/tmp
> /usr/dave/.tmp
> /var/.tmp
>
> I don't have a clue, otherwise. I know I never set them up. A couple of
> years ago (discussion here I think) I looked into putting the /tmp
> directory on a ram drive.
>
> The not being emptied situation has to be corrected. I am parsimonious with
> my HD space, even though I have close to a TB of space on several drives.
> The cumulative total of all the /tmp directories is almost 3 GB.
>
> TIA!
>
> Dave
>
>
>


Well probably some stuff you installed uses them.

When I was building big servers for many users, we had a nightly cron
script that did many things, one of which was to trawl through 'temp'
areas and delete anything more than a week old.


man cron
man find

Another was to perform tape backups.

A third was to identify any large areas of disk usage and e-mail the
admin with details


Reboot was not an option, because our systems stayed up 24x7 - the
longest being 18 months...


Welcome to the world of real system administration...
>
> ~~~~~~~~~~~~~~~~~~~~~~~~
> Study History - Know the Future

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:03 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0