Linux 單個tomcat多實例部署shell腳本詳解
更新時間:2017年02月28日 08:56:06 作者:lean1252
這篇文章主要介紹了Linux 單個tomcat多實例部署shell腳本詳解的相關(guān)資料,需要的朋友可以參考下
Linux 單個tomcat多實例部署shell腳本詳解
步驟:
1. 下載tomcat,解壓安裝
2.將tomcat下的webapps,conf,temp等目錄分別拷至根目錄www下A,B,C目錄下
3.新建如下腳本restart_tomcat.sh
4.使用restart_tomcat.sh A/B/C
#!/bin/sh
if [ -z $1 ]
then
echo "\033[31;1mplease input the app which you need restart...\033[0m"
exit 1
fi
base_dir=/Users/huangyunxing/Documents/work/www
if [ ! -d ${base_dir}/$1 ]; then
echo -e "\033[31;1mcan't find the directory [${base_dir}/$1] or the [${base_dir}/$1] is no a directory, please check it...\033[0m"
exit 1
fi
if [ ! -f ${base_dir}/$1/conf/server.xml ]; then
echo -e "\033[31;1mcan't find the file [${base_dir}/$1/conf/server.xml] or the [${base_dir}/$1/conf/server.xml] is not a file, please check it...\033[0m"
exit 1
fi
if [ ! -d ${base_dir}/$1/webapps ]; then
echo -e "\033[31;1mcan't find the directory [${base_dir}/$1/webapps] or the [${base_dir}/$1/webapps] is not a directory, please check it...\033[0m"
exit 1
fi
export CATALINA_BASE=${base_dir}/$1
if [ -f ${CATALINA_BASE}/setenv.sh ];then
. "${CATALINA_BASE}/setenv.sh"
echo "=========load setenv.sh finshed========"
fi
res=`ps aux | grep $1|grep "$JAVA_HOME/bin/java"|egrep -v "grep"|awk '{print $2}'`
if [ "$res" == "" ]; then
echo -e "\033[44;38;1mthe tomcat is not running, begin startup...\033[0m"
else
echo -e '\033[45;35;1mcurrent running pid is' $res',begin to stopping...\033[0m'
kill -9 `ps aux | grep $1|grep "$JAVA_HOME/bin/java"|egrep -v "grep"|awk '{print $2}'` && echo -e '\033[45;35;1mtomcat killed successfully\033[0m'
fi
rm -fr $CATALINA_BASE/work/*
rm -fr $CATALINA_BASE/temp/*
${CATALINA_HOME}/bin/catalina.sh jpda start -config ${base_dir}/$1/conf/server.xml && echo -e "\033[44;32;1mTomcat startup finished...\033[0m"
pid=`ps aux | grep $1|grep "$JAVA_HOME/bin/java"|egrep -v "grep"|awk '{print $2}'`
echo -e "\033[46;38;1m new running pid is ${pid}...\033[0m"
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
您可能感興趣的文章:
相關(guān)文章
centos6.5中用yum方式安裝php5.4與apache2.2的步驟
相信大家都知道lamp的安裝配置,最麻煩的是apache和php,網(wǎng)上關(guān)于apache和php的安裝配置有很多的相關(guān)文章,本文通過針對版本進行詳細的介紹,文章主要介紹的是centos6.5中用yum方式安裝php5.4與apache2.2的步驟,感興趣的朋友們可以參考學(xué)習(xí)。2016-10-10
centos7.2搭建LAMP環(huán)境的具體操作方法
下面小編就為大家?guī)硪黄猚entos7.2搭建LAMP環(huán)境的具體操作方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-08-08
Linux內(nèi)核私闖進程地址空間并修改進程內(nèi)存的方法
這篇文章主要介紹了Linux內(nèi)核私闖進程地址空間并修改進程內(nèi)存的方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10
linux后臺啟動Jar包打印日志方式(windows10)
這篇文章主要介紹了linux后臺啟動Jar包打印日志方式(windows10),具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-07-07
linux新文件權(quán)限設(shè)置之umask的深入理解
這篇文章主要給大家介紹了關(guān)于linux新文件權(quán)限設(shè)置之umask的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-03-03

