linux回退脚本,tomcat 回滚脚本

#!/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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值