TMP folder, is everything deletable in there?
I was just wondering the /tmp folder is everything just temp file sin there?what is it used for?
|
Not everything in there is deletable, it would do bad things. /tmp is used as a "storage" area for currently running programs. I use it for when I want to just store something in and don't care if I forget about it or not ( even though I'm usually good in my clean up ). Things that are placed in /tmp will be removed when the machine is rebooted.
Typically, you don't want to just start deleting things that are in there on a whim...but who knows, maybe you can, give it a try, that's the only way you'll know for sure! :-D |
First of all, don't attempt to delete everything in /tmp if you have gui sessions and/or a number of services running...
but, (if you are asking whether it is safe to delete everything in /tmp before a shutdown or reboot), the answer is yes, though you would typically perform the delete with a privelged account /process. While one or more gui sessions are running there are lock files in /tmp that are necessary to keep things in order. also, If your're running something like mysql it may maintain a socket in /tmp for communication client to server. if your box is running all the time and you are concerned about /tmp getting cluttered you could run (as root) LASTCHNG='+2' # set to the number of days back files are considered 'old' find /tmp/* -ctime $LASTCHNG -exec rm -rfv {} \; 20061216 edited the above line, taking out `#' at the beginning (it was supposed to represent the root prompt :/ Regards, JOhn I. |
"Another query on /tmp"
I am using suse 10.0 , It has created many temporary files in /tmp folder around 3 GB , How do I know which files i could delete while i am running. or can i delete all while running in safe mode.
any suggestions please. |
Did you try the above code I posted?
Since then I added checking for open files. The following bash script seems to work : Code:
#!/bin/bash Caveats: o You must have mktemp installed to run without the kludge for the output file of `lsof' o On some systems /var/tmp is a symlink to /tmp so a separate loop for it would be a waste. o The echo statements are just for a sanity check. They can be safely deleted (in face the entire else stanza inside the `do' can be). o Some might question putting the output of `lsof` into a file on /tmp, where stuff is being deleted. -cmin + <minutes> protects you. o the `rm' on line 21 could also need the -f (force) flag. |
Weird nobody mentioned tmpwatch yet.
|
Good Point
unSpawn: yes, tmpwatch would be the smarter way to go, if it's installed. When I got fedora going again recently I saw it in /etc/cron.daily but went ahead and copied my script from the slack box. `tmpwatch' didn't seem to be doing anything. Now looking at it, i see why, the default settings are very conservative. 10 days since file accessed, 30 days for /var/tmp.
tmpwatch is no doubt safer (checks for possible race conditions). guess i'll adjust the settings and re-enable it on fedora. syinx: if tmpwatch is not installed it should be available thru yast |
All times are GMT -5. The time now is 02:25 AM. |