tomcat快速部署指令碼

2022-06-11 20:48:12 字數 2235 閱讀 9055

#!/bin/bash

#-*- coding: utf-8 -*-

#date:   2018/12/28

#author:  mr.yang

#指令碼可根據需求修改

tomcat6="

tomcat6版本

"tomcat7="

tomcat7版本

"tomcat8="

tomcat8版本

"i="0"

read -p "

請輸入專案名不含任何符號(例:aaa):

" pjname && read -p "

請輸入安裝目錄絕對路徑(例/test/test):

"installation

mkdir -p $

read -p "

請輸入tomcat版本(tomcat+6/7/8):

"tomcat

cd $installation

if [ $tomcat == tomcat6 ];then

wget

$tomcat6

elif [ $tomcat == tomcat7 ];then

wget

$tomcat7

elif [ $tomcat == tomcat8 ];then

wget

$tomcat8

firead -p "

請輸入日誌目錄(例/logs/backup):

" logs && mkdir -p $logs

read -p "

請輸入平台名稱:

" platform && read -p "

請輸入使用者密碼:

"passwd

useradd $$

echo

"$passwd

" | passwd --stdin $$

read -p "

請輸入埠號:(關閉埠號自動+1000)

"prot

while [ $i -le 3

]

dofin=`find /web/ -depth -name "

*$prot

"| awk -f"

[/_]+"'

' | wc -l`

find /web/ -depth -name "

*$prot

"| awk -f"

[/_]+"'

' | wc -l

if [ $fin != 0 ];then

echo

"埠目錄存在……

" && read -p "

請重新輸入埠號:

"prot

i=$((i+1

))

if [ $i -lt 3 ];then

continue

elif [ $i -eq 3 ];then

echo

"請仔細核對埠後,再次執行……

"exit

fips -ef |grep $prot | grep -v grep

if [ $? -eq 0 ];then

echo

"啟用埠重複……

" && read -p "

請重新輸入:

"prot

elif [ $? -ne 0 ];then

echo

"無埠重複,繼續進行……"fi

elif [ $fin == 0 ];then

echo

"無埠重複……

"break

fidone

echo

"建立中……請稍後……

"tar=`ls | awk

'/jdk/'`

tar xf $$ && rm -rf $$

gz=`ls | awk

'nr==1'`

mv$gz tomcat_$

sed -i "

s/8080/$/g

" $/tomcat_$/conf/server.xml

prot=$(($+1000

))

sed -i "

s/9080/$/g

" $/tomcat_$/conf/server.xml

chown -r $$.$$ $ $

su - $$ -c "

sh $/tomcat_$/bin/startup.sh

"

快速部署tomcat專案的Shell指令碼

為了做集群測試,在每台機器上裝了3個tomcat,每次發布專案的時候都要反覆敲一些命令,重啟tomcat之前先檢查tomcat程序有沒有停掉,沒有還要手動kill該程序。發布次數多了,操作就比較繁瑣了,索性寫個指令碼一鍵發布,省時省力 把deploy.sh和restart.sh分別拷貝到3個tomc...

快速部署Tomcat專案的Shell指令碼

為了做集群測試,在每台機器上裝了3個tomcat,每次發布專案的時候都要反覆敲一些命令,重啟tomcat之前先檢查tomcat程序有沒有停掉,沒有還要手動kill該程序。發布次數多了,操作就比較繁瑣了,索性寫個指令碼一鍵發布,省時省力 把deploy.sh和restart.sh分別拷貝到3個tomc...

Shell 指令碼tomcat部署專案

變數var.sh bin bash 備份檔案 backupsource a b a,b為檔案 backupsource 備份放在什麼檔案下 backuptarget backup 專案檔案發在什麼檔案下 新的var包 projectwar new tjy admin iss.war tomcat的啟...