[ec2-user@ip-10-240-4-214 opt]$ more 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
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/.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