Linux下部署Tomcat无法启动

(sudo) vi /opt/tomcat/apache-tomcat-7.0.62/bin/catalina.sh

catalina.sh:

CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/opt/tomcat/apr/lib"
export JAVA_HOME=/opt/tomcat/jdk1.7.0_79
export JRE_HOME=/opt/tomcat/jdk1.7.0_79/jre
export CATALINA_HOME=/opt/tomcat/apache-tomcat-7.0.62
JAVA_OPTS="-server -Xms3000m -Xmx3000m -Xmn1800m -Xss256k -XX:PermSize=256m  -XX:MaxPermSize=400m"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParallelOldGC"
#JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=5 -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabl
ed -XX:+UseCompressedOops"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$CATALINA_HOME/logs/oom_java_heapDum$(date +%Y%m%d%H%M%S).hprof"
JAVA_OPTS="$JAVA_OPTS -verbose:gc -XX:+PrintGCDateStamps  -XX:+PrintGCDetails -Xloggc:$CATALINA_HOME/logs/gc$(date +%Y%m%d%H%M%S).log"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=$MONITOR_IP"


container-newrestart.sh:
#!/bin/bash
echo publish start
pid=`ps -ef|grep tomcat|grep -v grep|awk '{print $2}'`
if [ "$pid" = "" ] ; then
    echo Tomcat is not started
else
    kill -9 $pid
fi

echo killed process is ok
sleep 5
# bak webapp
date=$(date +%Y%m%d%H%M%S)
mkdir /opt/bak/C2Mobile-$date
cp -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2* /opt/bak/C2Mobile-$date/

rm -rf /opt/tomcat/apache-tomcat-7.0.62/work/Catalina
rm -rf /opt/tomcat/apache-tomcat-7.0.62/conf/Catalina
rm -rf /opt/tomcat/apache-tomcat-7.0.62/work/Catalina
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/common
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/error
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/images
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/scripts
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/styles
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/WEB-INF
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/META-INF
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2*/*.jsp

rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/common
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/error
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/images
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/scripts
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/styles
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/WEB-INF
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/META-INF
rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/M*/*.jsp

echo remove temp files is ok
#rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile.war
echo remove temp files is ok

cp /opt/faban/C2Mobile.war /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile.war
echo copy package is ok

unzip /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile.war -d /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile
cp -r /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile/*  /opt/tomcat/apache-tomcat-7.0.62/webapps/MCRM


\cp -f /opt/conf/config.properties /opt/conf/log4j.xml /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile/WEB-INF/classes
\cp -f /opt/conf/config.properties /opt/conf/log4j.xml /opt/tomcat/apache-tomcat-7.0.62/webapps/MCRM/WEB-INF/classes


\cp -f /opt/conf/C2Mobile/context.xml /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile/META-INF
\cp -f /opt/conf/MCRM/context.xml /opt/tomcat/apache-tomcat-7.0.62/webapps/MCRM/META-INF


\cp -f /opt/conf/C2Mobile/yulong-scheduler.xml /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile/WEB-INF
\cp -f /opt/conf/MCRM/yulong-scheduler.xml /opt/tomcat/apache-tomcat-7.0.62/webapps/MCRM/WEB-INF


rm -rf /opt/tomcat/apache-tomcat-7.0.62/webapps/C2Mobile.war

/bin/sh /opt/tomcat/apache-tomcat-7.0.62/bin/startup.sh
echo tomcat has started
echo Mobile WEB PUBLISH END

你可能感兴趣的:(Linux)