#!/bin/bash
s1=(`wc -c /app/soft/domains/Mobile_domain/servers/$1/logs/$1.out | awk '{print int($1/1024/1024)}'`)
if [ ! -d /app/soft/backlog/$1/ ];then
mkdir -p /app/soft/backlog/$1/
else
echo "已存在"
fi
if [ $s1 -ge "2040" ];
then
cp /app/soft/domains/Mobile_domain/servers/$1/logs/$1.out /app/soft/domains/Mobile_domain/servers/$1/logs/$1.out00$(date +%Y-%m-%d-%H-%M)
>/app/soft/domains/Mobile_domain/servers/$1/logs/$1.out
>/app/soft/tengine/nginx/logs/access.8888.log
fi
find /app/soft/domains/Mobile_domain/servers/$1/logs/access.log0* | xargs tar -zcvf /app/soft/backlog/$1/access$(date +"%Y%m%d%H%M").tar.gz
find /app/soft/domains/Mobile_domain/servers/$1/logs/access.log0* | xargs rm
find /app/soft/domains/Mobile_domain/servers/$1/logs/$1.log0* | xargs tar -zcvf /app/soft/backlog/$1/log$(date +"%Y%m%d%H%M").tar.gz
find /app/soft/domains/Mobile_domain/servers/$1/logs/$1.log0* | xargs rm
find /app/soft/domains/Mobile_domain/servers/$1/logs/$1.out0* | xargs tar -zcvf /app/soft/backlog/$1/out$(date +"%Y%m%d%H%M").tar.gz
find /app/soft/domains/Mobile_domain/servers/$1/logs/$1.out0* | xargs rm
find /app/soft/backlog/$1/ -type f -mtime +3 -exec rm -rf {} \;
阅读(1964) | 评论(0) | 转发(0) |