Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

They are just taking too much disk space, is it safe to delete them?

Is there anything I have to take special care of when I set up a crontab job to do the deletion routinely? Thanks!

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You would be better off logrotate. You can set it up with a maximum size for each file, and a number of files to maintain. I can then maintain a certain volume of files - eg. 10 files at 10Mb each for a total of 100M. Logrotate is configurable for all files, apache can be configured to manage that itself too.

Stuff in /tmp/ is theoretically removable - but processes relying on them will be upset. eg. MySQL stored the socket file there by default, so other processes using it to connect won't be able to.

You're better off emptying /tmp as part of your reboot process - it should be emptied then automatically.

share|improve this answer
2  
Don't forget to tell logrotate to gzip the files - log files are one of the most compressible things out there - i've seen 20 GB files go to 1 GB or less –  Zypher Feb 3 '10 at 3:04
    
For now: stop apache, blow away the logs and start it again. For the future: Please for the love of disk space rotate (and compress) your logs! –  voretaq7 Feb 3 '10 at 3:46
1  
Re: /tmp - If the last atime / mtime is more than a month ago you can "probably" delete it. Personally I would do as Alex suggests: reboot and let your boot scripts clean up /tmp (assuming they do), then find out who isn't cleaning up after themselves & fix the broken behavior. –  voretaq7 Feb 3 '10 at 3:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.