公司现网的两个应用日志
[root@192_168_100_36 app]# vim rmlog_talen.sh
#!/bin/sh
#For delete musicwap's log(retention 40 days)
#查找修改时间大于40天的文件并删除
find /app/musicwap/tomcat6.0.20_8[1-2]80/logs -mtime +40 -name '*.log' -exec rm -rfv {} \;
#查找修改时间大于40天的文件并删除
find /app/musicwap/logs/ -mtime +40 -name '*.log.20*' -exec rm -rfv {} \;
#压缩未删除的40天内的日志,并排除今天的日志
ls /app/musicwap/logs/*.log.20* |grep -v $(date +%Y-%m-%d)|grep -v '*.gz' |xargs bzip2 --best -v
#For delete mrpmusic's log(retention 40 days)
find /app/mrpmusic_[1-4]/logs -mtime +40 -name '*.log.20*' -exec rm -rfv {} \;
ls /app/mrpmusic_[1-4]/logs/*.log.20* |grep -v $(date +%Y-%m-%d) |xargs bzip2 --best -v
阅读(1727) | 评论(0) | 转发(0) |