#!/bin/sh

echo shell start `date +%Y-%m-%d`
echo catalina.out backup start

TOMCAT_LOG=/usr/local/apache-tomcat-7.0.56/logs
BACK_DIR=/data/tomcat
DATE=`date +%Y_%m_%d`

if [ ! -d $BACK_DIR/catalina.out ]
then
mkdir $BACK_DIR/catalina.out
fi

cp $TOMCAT_LOG/catalina.out $BACK_DIR/catalina.out.$DATE
cat /dev/null > $TOMCAT_LOG/catalina.out

echo catalina.out backup end
echo shell end `date +%Y-%m-%d`