Linux 單個(gè)tomcat多實(shí)例部署shell腳本詳解
Linux 單個(gè)tomcat多實(shí)例部署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"
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
相關(guān)文章
linux grub的啟動(dòng)加密及刪除恢復(fù)方法
這篇文章主要介紹了linux grub的啟動(dòng)加密及刪除恢復(fù)方法,需要的朋友可以參考下2016-10-10Linux之crontab定時(shí)執(zhí)行腳本方式
這篇文章主要介紹了Linux之crontab定時(shí)執(zhí)行腳本方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-04-04centos7下安裝并配置supervisor守護(hù)程序的操作方法
這篇文章主要介紹了centos7下安裝并配置supervisor守護(hù)程序的操作方法,本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-10-10Centos 7.4中的遠(yuǎn)程訪問(wèn)控制的實(shí)現(xiàn)方法
這篇文章主要介紹了Centos 7.4中的遠(yuǎn)程訪問(wèn)控制的實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11Linux運(yùn)維之如何使用ss命令代替netstat
這篇文章主要給大家介紹了關(guān)于Linux運(yùn)維之如何使用ss命令代替netstat的相關(guān)資料,需要的朋友可以參考下2019-07-07linux 程序安裝目錄/opt目錄和/usr/local目錄的區(qū)別
這篇文章主要介紹了linux 程序安裝目錄/opt目錄和/usr/local目錄的區(qū)別,需要的朋友可以參考下2018-06-06Linux服務(wù)器配置ip白名單防止遠(yuǎn)程登錄以及端口暴露的問(wèn)題
今天小編就為大家分享一篇Linux服務(wù)器配置ip白名單防止遠(yuǎn)程登錄以及端口暴露的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-07-07