2

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!

1 Answer 1

6

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.

3
  • 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, 2010 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, 2010 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, 2010 at 3:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .