Close method: 1. Use the "cd bin directory path under Tomcat" command to enter the bin directory under Tomcat; 2. Use the "./shutdown.sh" command to shut down the Tomcat service; 3. Use "kill - 9 process number" command to forcefully shut down the Tomcat process.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
In Linux system, use commands to start and shut down Tomcat.
Enter the bin directory under Tomcat
cd /java/tomcat/bin
Stop Tomcat service command
./shutdown.sh
After executing tomcat ./shutdown.sh, although the tomcat service cannot be accessed normally, ps - After ef | grep tomcat, it was found that the java process corresponding to tomcat was not destroyed when the web container was closed, and there was a zombie java process. After reading online, the reason for the zombie process may be that there are non-daemon threads (i.e. User Thread), and the jvm will not exit (when all threads in the JVM are daemon threads, the JVM can exit; if there is another or above non-daemon threads, the JVM will not exit). Use the following command to check whether the Tomcat process has ended:
ps -ef|grep tomcat
If similar information is displayed, it means that the Tomcat process has not ended
gateway 14705 14703 12 08:29 pts/0 00:03:10 /www/websoft/java/java1/jdk1.7.0_25/jre/bin/java -Djava.util.logging.config.file=/www/websoft/tomcat1/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Xms1536m -Xmx1536m -Xss256k -XX:MaxPermSize=512m -XX:+UseParallelGC -XX:ParallelGCThreads=20 -XX:+UseParallelOldGC -XX:MaxGCPauseMillis=100 -XX:+UseAdaptiveSizePolicy -Djava.endorsed.dirs=/endorsed -classpath /www/websoft/tomcat1/bin/bootstrap.jar:/www/websoft/tomcat1/bin/tomcat-juli.jar -Dcatalina.base=/www/websoft/tomcat1 -Dcatalina.home=/www/websoft/tomcat1 -Djava.io.tmpdir=/www/websoft/tomcat1/temp org.apache.catalina.startup.Bootstrap start
At this time we can forcefully terminate the process (zombie process)
kill -9 14705
After the previous command is executed, check the Tomcat process again. Tomcat has completely stopped.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to shut down tomcat in linux. For more information, please follow other related articles on the PHP Chinese website!