tomcat进程管理
linux下,通过tomcat控制台管理tomcat,老是出现tomcat无法完全重启,所以就需要直接杀死进程以达到 重启的目的,为此,写了一个小脚本,以此来用于管理tomcat。
前提假设我们多个tomcat的名称为tomcat-firstweb、tomcat-secondweb、tomcat-thridweb、tomcat-manage
关闭tomcat进程
12345678910111213141516171819202122232425262728293031#!/bin/bash# 判断输入应用名称judgeName(){read -t 30 -p "please input the app name: " namecase $name infirstweb | secondweb | mrtauth | thridweb)shutdownApps $name ;;manage)echo "Please input tomcat-manege. Try again!";;tomcat)echo "Input is disabled";;*)echo "Input error. try again!";;esac}# 关闭tomcatshutdownApps(){ps -ef | grep tomcat | grep $name | awk '{print $2}' | while read portdokill -9 $port#echo $portdoneecho "$name shutdown"ps -ef | grep tomcat | grep $name}judgeName启动tomcat
|
|
- 重启tomcat
|
|