码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat 回滚脚本

时间:2018-08-03 16:30:03      阅读:288      评论:0      收藏:0      [点我收藏+]

标签:webapps   tst   bin   logging   mys   run   ems   hit   min   


#!/bin/bash

#

# Artems rollback  Script.

# Author: Rui.Xu

# Time: 07/2018

#


rm -fr /app/tmp/artemis.war


dir1=/app/tmp/backup-package/


dir2=`ls -l $dir1 | tail -n1 |awk  '{print $NF}'`


yes | cp $dir1$dir2/artemis-* /app/tmp/artemis.war


#/etc/init.d/artemis stop

ps -aux | grep /app/apps/artemis/tomcat | grep -v grep | awk '{print $2}' | while read pid

do

    echo "tomcat is running, to kill bootstrap pid=$pid"

    kill -9 $pid

    echo "kill result:[ $? ]   0=ok"

done


sleep 3s

rm -rf /app/apps/artemis/tomcat/webapps/*

rm -rf /app/apps/artemis/tomcat/work

rm -rf /app/apps/artemis/tomcat/temp/*

mkdir /app/apps/artemis/tomcat/webapps/artemis

cp /app/tmp/artemis.war /app/apps/artemis/tomcat/webapps/artemis

cd /app/apps/artemis/tomcat/webapps/artemis

unzip artemis.war  &> /dev/null

cd /

rm -rf /app/apps/artemis/tomcat/webapps/artemis/artemis.war

rm -rf /app/apps/artemis/tomcat/webapps/artemis/WEB-INF/lib/mysql-connector-java-5.1.37.jar

yes | cp -f /app/tmp/logback-spring.xml /app/apps/artemis/tomcat/webapps/artemis/WEB-INF/classes/

yes | cp -f /app/tmp/logback-spring.xml /app/apps/artemis/tomcat/webapps/artemis/WEB-INF/classes/config/log/logback-didiprod.xml

yes | cp -f /app/tmp/font/simsun.ttc /app/apps/artemis/tomcat/webapps/artemis/WEB-INF/classes/font

sleep 1


/etc/init.d/artemis start  &> /dev/null


sleep 5

ID=`ps -aux | grep /app/apps/artemis/tomcat | grep -v grep | awk '{print $2}'`

if [ ! "$ID" = "" ]

then

        echo -e "\033[33m Artemis is already running, and his pid is: [ $ID ]   \033[0m"

else

        echo -e "\033[5;33m Artemis run                             [ Failed ]  \033[0m" 

fi

sleep 2

echo '======================================================================='

echo "+  Real-time logging is coming /home/mnt/app/logs/artemis/artemis.log +"

echo '======================================================================='

sleep 2

tail -f /home/mnt/app/logs/artemis/artemis.log





#END


tomcat 回滚脚本

标签:webapps   tst   bin   logging   mys   run   ems   hit   min   

原文地址:http://blog.51cto.com/amunlinux/2154122

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!