---
title: "单个tomcat多实例部署shell脚本"
author: "lean1252"
date: "2014-09-29T19:44:24Z"
tags: []
categories: ["开源软件"]
slug: "tomcat-shell"
draft: false
lastmod: "2015-07-04T15:57:23Z"
id: 2123816
url: "https://asflex.iteye.com/blog/2123816"
---

> 步聚


> 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   
then  
  echo "\033; then  
   echo -e "\033 or the  is no a directory, please check it...\033; then  
   echo -e "\033 or the  is not a file, please check it...\033; then  
   echo -e "\033 or the  is not a directory, please check it...\033;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 ; then  
   echo -e "\033