View method: 1. Use the "cd /installation directory/tomcat/bin" command to enter tomcat's bin directory; 2. Use the "ps -ef|grep java" command to check the service startup status. If the process is displayed ID number, percentage of CPU occupied and other information, it means that tomcat is running.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
linux check whether tomcat is running
1. Enter the bin directory of tomcat
cd /你的安装目录/tomcat/bin
2. Check the service startup status
ps -ef|grep java
If the above information appears in the output result, it means it is running. Among them, the first is the user who started the process, the second is the id of the process, and the third is the percentage of CPU occupied. The fourth is the percentage of occupied memory
When using the kill command, you can directly kill the tomcat process
kill -9 7010
Continue to use the command to check whether tomcat has been closed
ps -ef|grep java
If the following message appears , indicating that tomcat has been closed
root 7010 1 0 Oct19 ? 00:30:30 [java]
Extended knowledge:
1. How to check the path of tomcat
find / -name ‘tomcat’
2. How to check tomcat Log
1) Switch to the logs directory of the path where tomcat is located
cd /你的安装目录/tomcat/logs
2) Execute the command to view the log
tail -f catalina.out
Determine how many lines of logs to view
tail -300 catalina.out
3. tail command parsing
format: tail [required parameters][selected parameters][file]
Function: used to display the content at the end of the specified file, without specifying a file , it is processed as input information. Commonly used to view log files.
Required parameters:
-f Loop reading
-q Do not display processing information
-v Display detailed processing information
-c
-n< ;Number of lines> Number of lines displayed
–pid=PID Used with -f to indicate that it will end after the process ID and PID die
-q, --quiet, --silent Never output the header of the given file name
-s, --sleep-interval=S Used with -f, it means that in Sleep for S seconds at each repeated interval
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to check whether tomcat is running in linux. For more information, please follow other related articles on the PHP Chinese website!