Linux篇

linux使用shutdown.sh命令关闭tomcat进程后还

2020-12-04  本文已影响0人  柳华聪

1、修改bin/catalina.sh文件

  查找PRGDIR=`dirname "$PRG"` 这一行;

  在这一行的下面增加语句:

  if [ -z "$CATALINA_PID" ]; then

    CATALINA_PID=$PRGDIR/CATALINA_PID

    cat $CATALINA_PID

  fi

  功能:判断 CATALINA_PID有没有配置,

  没有的话,就使用当前目录(bin)

  的CATALINA_PID文件来记录tomcat的进程ID

2、修改tomcat的shutdown.sh文件,在最后一行加上“-force”: 

  找到命令行: exec "$PRGDIR"/"$EXECUTABLE" stop "$@"

  修改为:exec "$PRGDIR"/"$EXECUTABLE" stop -force "$@"

  保存即可。

3、结果展示

root@i70l5wbwtduhmchqwZ:/usr/java/tomcat-7.0.92/bin# ./startup.sh

Using CATALINA_BASE:  /usr/java/tomcat-7.0.92

Using CATALINA_HOME:  /usr/java/tomcat-7.0.92

Using CATALINA_TMPDIR: /usr/java/tomcat-7.0.92/temp

Using JRE_HOME:        /usr/java/jdk1.8.0_191

Using CLASSPATH:      /usr/java/tomcat-7.0.92/bin/bootstrap.jar:/usr/java/tomcat-7.0.92/bin/tomcat-juli.jar

Using CATALINA_PID:    ./CATALINA_PID

Tomcat started.

root@i70l5wbwtduhmchqwZ:/usr/java/tomcat-7.0.92/bin# ./shutdown.sh

Using CATALINA_BASE:  /usr/java/tomcat-7.0.92

Using CATALINA_HOME:  /usr/java/tomcat-7.0.92

Using CATALINA_TMPDIR: /usr/java/tomcat-7.0.92/temp

Using JRE_HOME:        /usr/java/jdk1.8.0_191

Using CLASSPATH:      /usr/java/tomcat-7.0.92/bin/bootstrap.jar:/usr/java/tomcat-7.0.92/bin/tomcat-juli.jar

Using CATALINA_PID:    ./CATALINA_PID

Tomcat stopped.

上一篇下一篇

猜你喜欢

热点阅读