VectorLinux
September 01, 2014, 05:24:43 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: rm content of /tmp folder at each boot  (Read 2111 times)
vvucic
Packager
Vectorite
****
Posts: 104


WWW
« on: November 20, 2010, 02:57:10 pm »

How to get my VL 6.0 KDE Classic to rm the content of /tmp folder at each reboot.
I created crontab file with line:
@reboot rm /tmp/*

but it does not rm the content of /tmp folder at reboot.

Thanks,

Vedran
Logged
M0E-lnx
Administrator
Vectorian
*****
Posts: 3179



« Reply #1 on: November 20, 2010, 05:40:24 pm »

Why are you trying to clear out /tmp at boot?
Some important stuff is kept there... sockets to running apps and stuff. If any of these are created during the boot process, you could mess up these apps.
Logged

vvucic
Packager
Vectorite
****
Posts: 104


WWW
« Reply #2 on: November 21, 2010, 12:17:38 am »

All download tem pfiles are there and in the course of time they consume too much space...
 On several OpenSuse machines I have set upthat /tmp folder is cleared during boot and I did not have any issues with any app.

Thanks,

vedran
Logged
nightflier
Administrator
Vectorian
*****
Posts: 4022



« Reply #3 on: November 21, 2010, 05:29:01 am »

You would need to put the delete command before the reboot, and separate the two. Something like:
rm -rf /tmp/* && shutdown -r now
Logged
vvucic
Packager
Vectorite
****
Posts: 104


WWW
« Reply #4 on: November 21, 2010, 01:51:33 pm »

Hello,

Where should I put this command?

Thanks,

veki
Logged
sledgehammer
Vectorian
****
Posts: 1422



« Reply #5 on: November 21, 2010, 09:29:19 pm »

Good question.

One of my browsers downloads to /tmp and so every so often I delete most of the files in it (generally can't delete them all). Firefox downloads to Downloads, if I recall, and there doesn't seem to be any problem in deleting the files in Downloads every once in a while.

Perhaps in one of the next versions of VL, when quitting, an option to Delete Unnecessary files in /tmp would be of assistance? 

Nonetheless, I bet the answer to your question is to just put nightflier's command on on the terminal command line (CLI).  I will try it next time I shutdown.
Logged

VL7.0 xfce4 Samsung RF511
GrannyGeek
Packager
Vectorian
****
Posts: 2567


« Reply #6 on: November 21, 2010, 09:45:22 pm »

One of my browsers downloads to /tmp and so every so often I delete most of the files in it (generally can't delete them all). Firefox downloads to Downloads, if I recall, and there doesn't seem to be any problem in deleting the files in Downloads every once in a while.

The download location for Firefox (and SeaMonkey and Opera) is user configurable. What is downloading to /tmp? Can you change it?
--GrannyGeek
Logged

Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller
vvucic
Packager
Vectorite
****
Posts: 104


WWW
« Reply #7 on: November 21, 2010, 09:53:03 pm »

As far as I see wherever you download your filesthey are placed in /tmp.
For example, in OpenSuse you can in Yast find option to configure options related to /etc/sysconfig and you can find there cron options. one of cron options is to clear /tmp orother other folder at boot time.
This may be quite handy.
I can put any command by hand, but idea is to makeit automatic.

Thanks,

Veki 
Logged
nightflier
Administrator
Vectorian
*****
Posts: 4022



« Reply #8 on: November 22, 2010, 09:18:36 am »

vvucic, there are probably many ways of achieving what you want. I would think that it would be better to clear /tmp at shutdown than during startup. What DE are you running (xfce, kde, gnome...)?

Alternative approach: On my system, I put /tmp in RAM, using tmpfs. This is to minimize writes to the SSD, and to speed things up in general. Only drawback I have found is that some apps manage to exhaust the space available. So far, all that I use (llike k3b) can be configured to use a different temp directory, avoiding that problem. If you have enough memory (2G is a good number), it only takes an entry in /etc/fstab to enable this:
Code:
tmpfs   /tmp        tmpfs rw,suid,dev,exec,auto,nouser,async,noatime 0  0
Logged
sledgehammer
Vectorian
****
Posts: 1422



« Reply #9 on: November 22, 2010, 09:25:37 am »

Granny,

You are right.  I mis-stated.  Its not the browser that downloads to /tmp by default, but XPDF that defaults to /tmp.  Generally, in Seamonkey, I open the pdf rather than save it.  It opens in xpdf, my favorite pdf reader.  I then try to save it and xpdf defaults to /tmp.  I can change that on a download by download basis (don't think it can be done for all saves), but its a pain.  So I generally save to /tmp and then use 4pane to copy file to proper place on hard drive.

John
Logged

VL7.0 xfce4 Samsung RF511
vvucic
Packager
Vectorite
****
Posts: 104


WWW
« Reply #10 on: November 22, 2010, 09:53:19 am »

Hello,

I want to save relatively old machine with limited HD space and make use of HD space tidy. Thus, I want it to clean /tmp space. I know that it is possible to put it in RAM, but on modes machines there is shortage of RAM so it is not doable.
I want to do that as cron job or regular procedure during shutdown process.
Thus, I need to know in which file I have to put that command in order to do that.

I tried as cron, but it does not perform its job? :p
Is there any runlevel script that may be modified in that way?

Thanks,

vedran
 
Logged
nightflier
Administrator
Vectorian
*****
Posts: 4022



« Reply #11 on: November 22, 2010, 10:14:00 am »

Try to edit "/etc/rc.d/rc.K". Add the delete command before the shutdown section.
Logged
toothandnail
Tester
Vectorian
****
Posts: 2527


« Reply #12 on: December 04, 2010, 09:04:42 am »

The simplest option for clearing out /tmp is to install tmpreaper (Gslapt should find it) and put a call to it in /etc/rc.d/rc.local. That way, temporary files will be cleared every time the machine is started. Tmpreaper is also selective - you can set it to only delete files that have not been touched in a set amount of time.

I use this in my /etc/rc.d/rc.local:

Code:
/usr/sbin/tmpreaper 24 /tmp

That will cull any files in /tmp that have not been touched in 24 hours.

Paul.
Logged
vvucic
Packager
Vectorite
****
Posts: 104


WWW
« Reply #13 on: December 04, 2010, 01:05:35 pm »

Thanks a lot. Gslapt found tmpreaper and I edited /etc/rc.d/rc.local


Best wishes,


Vedran
Logged
Joe1962
Administrator
Vectorian
*****
Posts: 2499



WWW
« Reply #14 on: December 06, 2010, 07:24:10 am »

Might be simpler to use:
Code:
sudo find /tmp -mtime +5 -delete -depth

You can change the 5 days to whatever you need, of course. I recommend putting it in the system shutdown script (/etc/rc.d/rc.K), just after the commands to unmount the filesystems and the sync and sleep 1 commands.



EDIT: oops!!!  Shocked I don't know what I was smoking (which I don't, lol) when I wrote the above, of course you can't run that "AFTER" you unmount the filesystems, as you won't find anything... Roll Eyes
« Last Edit: December 08, 2010, 07:53:34 am by Joe1962 » Logged

O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!