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.

link|improve this question

71% accept rate
Duplicate post: serverfault.com/questions/212751/… – sinping Dec 15 '10 at 15:06
feedback

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

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

1 Answer

up vote 8 down vote accepted

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

/export/home/ftp/console.log {
  rotate 7
  daily
  compress
  missingok
  notifempty
}
link|improve this answer
+1, logrotate was built for this, no need to muck around with shell scripts. – Graeme Donaldson 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
feedback

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