tomcat 生产发布脚本

<pre name="code" class="sql">#!/bin/sh
#
#    程序名称         : tb.sh
#    程序功能         : 同步前置机参数文件
#    系统名称         : 浙江稠州商业银行综合业务系统
#    版    本         : 1.00
#
#    OS & Environment : Sco Unix 5.0.X
#
#
#    History          :
#
#      Date         Position   Author        Description
# --------------------------------------------------------------
#     2015-05-13               Scan
#
#

trap "" 2 3 15
echo
curdate=`date  '+%Y%m%d'`
#curdate=`date  '+%Y%m%d'`
dis_mainpublish="ZJZC-应用发布程序"
cat <<mayday
                	DATE:$curdate
	--------------------------------------------------
	             $dis_mainpublish
	--------------------------------------------------
	****** 1) "备份应用" *******
	****** 2) "更新应用" *******
	****** 3) "退出系统"   *******
mayday
	echo -n "please choose [1-2-3]:"
	read ANS
	case $ANS in
        1)
               cd /usr/local/apache-tomcat-7.0.55_8083/webapps
               tar -czvf pay.$curdate.tar.gz pay
               ls -ltr *.tar.gz
        ;;
        2)
              echo "请确认是否已上传最新的zip包,否则禁止发布(y|Y)"
              read ANS
          if [ "$ANS" = 'Y' ] || [ "$ANS" = 'y' ]
                  then 
                echo "停止tomcat应用"
                cd /usr/local/apache-tomcat-7.0.55_8083/bin
                sh ./shutdown.sh 
		        sleep 5
                  if  [ $(ps -ef | grep java | grep -v grep | wc -l ) -ne 0 ]
                      then
                          echo "java进程为"
                          ps -ef | grep java | grep -v grep
                          echo "Tomcat 无法停止是否继续(y|Y|N|n)"
                          read ANS
                              if [ "$ANS" = 'Y' ] || [ "$ANS" = 'y' ]
                                     then
                                 kill -9 `ps -ef | grep java | grep -v grep | awk '{print $2}'`
                                 echo "Tomcat 无法正常停止 强制killed"
				                 cd /usr/local/apache-tomcat-7.0.55_8083/webapps
                                 rm -rf pay
                                 unzip  zjzc-pay.zip
                                 mv zjzc-pay pay
                                 cd /etc/scripts/change
                                 sh ./a.sh
                                 cd  /usr/local/apache-tomcat-7.0.55_8083/bin
		                         echo "开始启动tomcat"
                                 sh ./startup.sh
			                   else
	                               exit 2
		                       fi	  
		          else
                         cd /usr/local/apache-tomcat-7.0.55_8083/webapps
                         rm -rf pay
                         unzip  zjzc-pay.zip
                         mv zjzc-pay pay
                         cd /etc/scripts/change
                         sh ./a.sh
                         cd  /usr/local/apache-tomcat-7.0.55_8083/bin
		                 echo "开始启动tomcat"
                         sh ./startup.sh
                fi
          else
          exit 1
          fi
        ;;
	3)
	     echo "退出菜单"
	     exit 0
		;;
	esac


 
 
 
 
 
 
 
 
 

你可能感兴趣的:(tomcat 生产发布脚本)