Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Script to delete files older than 30days

My hard disk suddenly became full and I searched around until I finally discovered that a "console.log.9" file buried in Library/Logs/Console/myname/ was 112 Gigs !

I couldn't able to open and check it properly.

I did some research and figured out the way for finding and deleting the log files older than 30 days from a specific path, using find and exec commands.

find /export/home/ftp ( -name console.log -or -name server.log ) -mtime +30 -exec rm -f {} +

But i want to rotate console.log in daily wise and Is any shell script to rotate the console.log daily.

Please help me out in this issue.

share|improve this question

marked as duplicate by splattne Dec 15 '10 at 18:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Duplicate post:… – sinping Dec 15 '10 at 15:06
up vote 8 down vote accepted

Add a file to /etc/logrotate.d, containing something like

/export/home/ftp/console.log {
  rotate 7
share|improve this answer
+1, logrotate was built for this, no need to muck around with shell scripts. – ThatGraemeGuy Dec 15 '10 at 8:20
i have one doubt,is log rotate affects the currently running jboss application. – Jayakrishnan T Dec 27 '10 at 13:00
Try using the copytruncate directive – Joril Dec 27 '10 at 13:15

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