LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 01-04-2004, 07:35 PM   #1
Whitehat
Senior Member
 
Registered: Feb 2003
Location: The Cold North
Distribution: SuSE 9.1
Posts: 1,289

Rep: Reputation: 45
Cool Cleaning up /var and /tmp....


(Slackware 9.1) [2.4.23 kernel]

Hey all,

What exactly can I clean up in /var and /tmp?

/var is a seperate partiton and /tmp is just under / .

Just curious. I don't want to clean up "too much".

I assume I should clean these at shutdown? Can I put something in rc.6* to run a clean up on these two directories?

Thanks,
Whitehat

Last edited by Whitehat; 01-04-2004 at 07:40 PM.
 
Old 01-04-2004, 07:41 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Actually Slackware should have these to clean up /tmp already at bootup time in your rc.M file in /etc/rc.d:

# Remove stale locks and junk files (must be done after mount -a!)
/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 2> /dev/null

# Remove stale hunt sockets so the game can start.
if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then
echo "Removing your stale hunt sockets from /tmp."
/bin/rm -f /tmp/hunt*
fi

As far as your /var directory, most of the time you can clear out your log files. Usually Slackware has logrotate enabled to do this for you. I personally made my own scripts to clear them up and back the files up. I'll tend to review some of my logs and if see nothing happening out of the ordinary, I'll run my script to clean the logs, restart syslog and be on my way, then usually deleting my backups after they've gotten older and I've added several other backed up log files.

I'd say if your not too worried about log files if you shutdown your machine when not using it, you can easily clear out the logs and tmp at shutdown, just removing them totally off your machine.

I can give you snippet of my script you could use to clear out the logs if you wanted?

Cheers

Last edited by trickykid; 01-04-2004 at 07:43 PM.
 
Old 01-04-2004, 07:43 PM   #3
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,592

Rep: Reputation: 188Reputation: 188
"I assume I should clean these at shutdown? Can I put something in rc.6* to run a clean up on these two directories?"

Yes. You can delete everything in /tmp during shutdown. For /var you can delete .log files and then touch them to recreate the log as an empty file. Cleaning up log files does not have to occur at shutdown. On SuSE I used to run a monthly cron job to clean up the log files. On Fedora I just use the logrotate scripts which I changed from four generations of log files to 2 generations.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

Last edited by jailbait; 01-04-2004 at 07:44 PM.
 
Old 01-04-2004, 08:07 PM   #4
Whitehat
Senior Member
 
Registered: Feb 2003
Location: The Cold North
Distribution: SuSE 9.1
Posts: 1,289

Original Poster
Rep: Reputation: 45
Ahh...

Very good.

Thanks to both of you.

Peace,
Whitehat
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
kde, /tmp, /var/tmp and all that garba Linux - Software 4 06-17-2005 01:31 PM
cleaning up tmp directories markus1982 Linux - General 7 09-19-2004 12:57 PM
cleaning up /var/adm/wtmp Risc91 AIX 5 08-23-2004 10:52 AM
Cleaning up /var partition - what to delete? mattkat Red Hat 1 09-24-2003 03:56 PM
Newbie question - /tmp /var/tmp Mr happy Linux - Security 3 01-27-2003 02:03 PM


All times are GMT -5. The time now is 08:54 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration