首页 > 代码库 > 压缩日志

压缩日志

#!/bin/bash


cd /tmp

LOG_PATH=`find /data/logs/ -mtime +1 -name "*".log | awk -F / ‘NF--‘|tr -s " " "/" | uniq`

for i in ${LOG_PATH};

   do

   cd ${i}

   find .  ! -name "." -type d -prune -o -type f -mtime +1 -name "*.log" -print |awk -F / ‘{print $2}‘ | xargs gzip -9

done


压缩日志