Here's a simple shell command to delete old log(or any) files.
Syntax:
Usage:
This will remove all compressed log files leaving recent 5 backups.
Syntax:
ls -t <list of files> | tail -n <count> | xargs rm -f
Usage:
ls -t /data/www/myapp/shared/log/*.log.gz | tail -n +6 | xargs rm -f
This will remove all compressed log files leaving recent 5 backups.
No comments:
Post a Comment