Linux系统Tomcat进程使用shutdown无法关闭进程
问题场景:
若在应用中启动了用户线程,在Linux系统Tomcat进程使用shutdown无法关闭进程。
解决方案:
#1、在catalina.sh文件中添加CATALINA_PID [root@localhost pc1]# vi bin/catalina.sh # CATALINA_PID (Optional) Path of the file which should contains the pid # of the catalina startup java process, when start (fork) is # used CATALINA_PID=./CATALINA_PID #2、设置强制关闭,修改尾行添加 -force [root@localhost pc1]# vi bin/shutdown.sh ... exec "$PRGDIR"/"$EXECUTABLE" stop -force "$@" #3、启动Tomcat并查看进程 [root@localhost pc1]# startup.sh [root@localhost pc1]# ps -ef|grep tomcat #4、关闭Tomcat [root@localhost pc1]# shutdown.sh #5、检查Tomcat进程 [root@localhost pc1]# ps -ef|grep tomcat
以上方式验证通过。