Linux under several Tomcat operation mode
- 2021-01-14 07:25:00
- OfStack
Tomcat on/off Linux
On Linux systems, starting and closing Tomcat is done using commands.
Enter the bin directory under Tomcat
cd /java/tomcat/bin
Start the Tomcat command
./startup.sh
Stop the Tomcat service command
./shutdown.sh
After execution tomcat. / shutdown. sh, although tomcat services cannot be normal visit, but ps ef | grep tomcat, find corresponding java tomcat process not destroyed with web containers closed, then there is zombie java process. ES34en does not exit ES36en when all threads in ES37en are daemons. ES38en does not exit ES37en when all threads are daemons. ES39en does not exit if there is 1 or more non-daemon threads). To see if the Tomcat process is over, press the following command:
ps -ef|grep tomcat
If similar information is displayed below 1, 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 point we can force the process to terminate (zombie process)
kill -9 14705
After the execution of the previous command, recheck the status of Tomcat process, Tomcat has been completely stopped.
Tomcat on Linux in several ways
tomcat service startup, shutdown and error tracking under Linux. After using PuTTy to remotely connect to the server, the tomcat service is usually started and shut down by the following ways:
Start the ES69en service
Method 1:
Direct start
./startup.sh
Method 2:
Start as a service
nohup ./startup.sh &
Method 3:
Console dynamic output mode to start
./catalina.sh run
Dynamic display of tomcat background console output information,Ctrl+C exit and close the service
Explanation:
tomcat starts from mode 1. 3, and the tomcat service stops immediately when the client is disconnected. It can run directly as linux service 1 through mode 2.
If tomcat is started in mode 1. 2, the log will be written to the corresponding log file, and the output information and error situation of the tomcat console cannot be dynamically viewed.
With mode 3, you can start the tomcat service in console mode, and see the console output directly in the background while the program is running, without having to bother to open it every time
catalina.out
Log file to view, so easy to track access to the background output information. tomcat console information includes
log4j
and
System.out.println()
Wait for the output of information.
conclusion