tomcat日誌壓縮
#! /bin/sh
date=$(/bin/date -d -1day +%Y-%m-%d)
tomcat_date=$(/bin/date -d -1day +%Y%m%d)
#tomcat日誌
tomcat_logs_path_a="PATH"
tomcat_logs_path_b="PATH"
tomcat_logs_path_d="PATH"
tomcat_logs_path_d="PATH"
tomcat_logs_path_e="PATH"
tomcat_logs_path_f="PATH"
#API項目日誌
project_logs_path_a="PATH"
project_logs_path_b="PATH"
project_logs_path_c="PATH"
project_logs_path_d="PATH"
project_logs_path_e="PATH"
project_logs_path_f="PATH"
project_logs_path_g="PATH"
project_logs_path_h="PATH"
#DAO項目日誌
project_logs_path_i="PATH"
project_logs_path_j="PATH"
project_logs_path_k="PATH"
project_logs_path_l="PATH"
project_logs_path_m="PATH"
project_logs_path_n="PATH"
project_logs_path_o="PATH"
#碼庫文件位置 PATH"
BACKUP_DIR_A="/data/var/log/cloud2/cy/"
BACKUP_DIR="/tmpzipfile/barcode_api/dow/"
# delete the folder greater than 13 days Tomcat_logs
#find "${tomcat_logs_path_a}" -regex ".*\.txt\|.*\.log\|.*\.out" -type f -mtime +13 -exec rm {} \;
#find "${tomcat_logs_path_b}" -regex ".*\.txt\|.*\.log\|.*\.out" -type f -mtime +13 -exec rm {} \;
#find "${tomcat_logs_path_c}" -regex ".*\.txt\|.*\.log\|.*\.out" -type f -mtime +13 -exec rm {} \;
#find "${tomcat_logs_path_d}" -regex ".*\.txt\|.*\.log\|.*\.out" -type f -mtime +13 -exec rm {} \;
#find "${tomcat_logs_path_e}" -regex ".*\.txt\|.*\.log\|.*\.out" -type f -mtime +13 -exec rm {} \;
#find "${tomcat_logs_path_f}" -regex ".*\.txt\|.*\.log\|.*\.out" -type f -mtime +13 -exec rm {} \;
#壓縮tomcat日誌
find ${tomcat_logs_path_a} -name "*${tomcat_date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${tomcat_logs_path_b} -name "*${tomcat_date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${tomcat_logs_path_c} -name "*${tomcat_date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${tomcat_logs_path_d} -name "*${tomcat_date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${tomcat_logs_path_e} -name "*${tomcat_date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${tomcat_logs_path_f} -name "*${tomcat_date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
#壓縮項目日誌
find ${project_logs_path_a} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_b} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_c} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_d} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_e} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_f} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_g} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_h} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_i} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_j} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_k} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_l} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_m} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_n} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_o} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
find ${project_logs_path_} -name "*${date}*" -type f|xargs -I {} tar zcvf {}.tar.gz --remove-files {}
echo "壓縮日誌完畢"
本文出自 “隱隱的淚” 博客,請務必保留此出處http://lijuntao.blog.51cto.com/11691147/1946342
tomcat日誌壓縮