Pages

Thursday 10 May 2012

delete of log file older than some day in linux

In liferay log file are created .
 It is difficult to delete every time manually . so here is command that delete all file older than 5 days in log folder.
find path to your log folder/* -mtime +5 -exec rm {} \;
for example
find /Server/tomcat-6.0.29/logs/* -mtime +5 -exec rm {} \;
This will delete all file in logs folder older than 5 days .
You can set this command as cron job so it clean your folder daily or weekly.

Thanks
Srikanth 

No comments:

Post a Comment