标签:local 后台 atl usr while bin font a.out size
#!/bin/bash
while true
do
cd /usr/local/tomcat/logs
d=`date +%Y%m%d`
d15=`date -d‘15 day ago‘ +%Y%m%d`
cp catalina.out /opt/logs/catalina.out.${d}
echo "" > catalina.out
rm -rf catalina.out.${d15}
sleep 86400
done
每天切割一次,并删除15天之前的日志:
放到后台执行:
yum -y install screen
screen
./tomcatlog.sh &
ctrl + a + d退出即可
标签:local 后台 atl usr while bin font a.out size
原文地址:http://www.cnblogs.com/fansik/p/7073247.html