1
#!/bin/bash
export JAVA_HOME=/usr/local/java8
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

# Tomcat目录
TOMCAT_PATH="/usr/local/tomcat01/"

WAR_PATH="/data/test01/ROOT"
cd ${WAR_PATH}
jar -xvf ${WAR_PATH}/app.war

# 关闭tomcat
${TOMCAT_PATH}/bin/shutdown.sh
sleep 5

result=`ps -ef | grep "$TOMCAT_PATH"  | grep -v grep` 
if [ "$result" != "" ];then
      pid=`echo $result|awk '{print $2}'`
      echo ${pid}
      kill -9 ${pid}
fi

# 启动tomcat
${TOMCAT_PATH}/bin/startup.sh

sleep 5

start=`ps -ef | grep "$TOMCAT_PATH"  | grep -v grep` 

if [ "$start" != "" ];then
      startPid=`echo $start|awk '{print $2}'`
      echo "Tomcat 启动成功(pid=$startPid)"
else
      echo "Tomcat 启动失败"
fi

asoren
404 声望15 粉丝

引用和评论

0 条评论