Startup and shutdown of Tomcat under Linux
Under Linux system, start and shut down Tomcat using command operation.
Enter the bin directory under Tomcat
Start Tomcat command
Stop Tomcat service command
After executing Tomcat. / shutdown.sh, although the Tomcat service can not be accessed normally, after PS – ef| grep tomcat, it is found that the java process corresponding to Tomcat is not destroyed with the web container closed, and then there is a zombie java process. The reason for the zombie process on the Internet may be that there are non daemonic threads (i.e. user threads) and the JVM will not exit (when all threads in the JVM are daemonic threads, the JVM can exit; if there is one or more non daemonic threads, the JVM will not exit). Check whether the Tomcat process ends with the following command:
ps -ef|grep tomcat
If similar information is displayed, the Tomcat process is not finished
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 force the end of the process (zombie process)
kill -9 14705
After the last command is executed, check the Tomcat process again, and Tomcat has stopped completely.
Several ways of Tomcat running on Linux
Start, shutdown and error tracking of Tomcat service under Linux. After using putty to connect to the server remotely, the Tomcat service is usually started and shut down in the following ways:
Start Tomcat service
Start as service
nohup ./startup.sh &
Console dynamic output mode start
./catalina.sh runDisplay the console output information of Tomcat background dynamically, and exit and close the service after Ctrl + C
There is a drawback in mode 1 and mode 3. When the client is disconnected, the Tomcat service will stop immediately. Mode 2 can run as a Linux service all the time.
When Tomcat is started in mode 1 and mode 2, its log will be written to the corresponding log file, instead of dynamically viewing the output information and error of Tomcat console;
In mode 3, you can start the Tomcat service in console mode, and directly see the console output information in the background when the program is running. You don’t have to open it every time
catalina.outLog files for viewing, which makes it easy to trace and consult the background output information. Tomcat console information includes
The above is the whole content of this article. I hope that the content of this article has some reference learning value for your study or work. Thank you for your support for developepaer. If you want to know more about it, please check the relevant links below