项目目录:webapps/apache-tomcat-7.0
脚本名称:startup.sh 放在Tomcat的根目录
cronolog将catalina.out分割为如:catalina.2017-09-06.out
#define jarPath=/webapps/apache-tomcat-7.0/bin/ jarName=apache-tomcat-7.0 logPath="../logs/catalina.`date +%Y-%m-%d`.out" pid=`ps -ef | grep $jarName | grep -v grep | awk '{print $2}'` #echo $pid if [ -n "$pid" ] then #!kill -9 force stop echo "kill -9 pid:" $pid kill -9 $pid echo "kill sucessfully" fi
cd $jarPath
sleep 10
./startup.sh & tail -f ${logPath}
快速查看cronolog分割的catalina.out日志的脚本,脚本名称:catalina.sh ,同样放在Tomcat的根目录
#define logPath="/webapps/apache-tomcat-7.0/logs/catalina.`date +%Y-%m-%d`.out" tail -f ${logPath}