Ubuntu under the Tomcat Monitor running progress method

Source: Internet
Author: User

If you have been using Tomcat under Windows, you will know that when you run Tomcat, a new console window pops up, and then the relevant server state information and the information that is exported during the program's run are displayed in this new window. But when it comes to Linux, the self-contained shell file does not open a new terminal window, which makes some Linux novices (including me) run into a lot of trouble when debugging a program. How should the problem be solved?
First, we need to know where the information displayed in the console of Windows is going. This problem is not difficult, in the logs directory of two files, one is Catalina.out, and the other is localhost. [Date].log. Originally, in the default case, Tomcat was outputting information to the log file in Linux. In this way, we have a solution, either to change the output of the information, or to find ways to monitor the two log files. Finally, I chose the latter, which is simple: use the tail command with the F parameter, where the F parameter means "data appended to the instant output file change". The specific commands are: Tail-f catalina.out.

ALT+F2 input gnome-terminal to open terminal

Shut down

Shutdown.sh-s

Start

cd/usr/local/apache-tomcat-6.0.10/bin/

2./startup.sh

3./catalina.sh Run (Display information to start, shut down will turn Tomcat off)


Linux kill all Tomcat processes for a user

PS aufx|grep tomcat|grep Root|awk ' {print $} ' |xargs kill-9

509 replace with user name to kill

Sometimes directly with shutdown.sh can not shut Tomcat, to force kill, but probably Tomcat started several times, the process has been more than one Tomcat process, a close to a very troublesome, the use of the above command to shut down a user all Tomcat process.


#看是否已经有tomcat在运行了

Ps-ef |grep Tomcat

#如果有, use kill;
Kill-9 pid #pid for the corresponding process number

For example Pe-ef |grep tomcat output is as follows

Sun 5144 1 0 10:21 pts/1 00:00:06/java/jdk/bin/java-djava.util.logging.manager=org.apache.juli.classloaderlogmanager -djava.endorsed.dirs=/java/tomcat/common/endorsed-classpath:/java/tomcat/bin/bootstrap.jar:/java/tomcat/bin/ commons-logging-api.jar-dcatalina.base=/java/tomcat-dcatalina.home=/java/tomcat-djava.io.tmpdir=/java/tomcat/ Temp Org.apache.catalina.startup.Bootstrap Start

Then 5144 is the process number PID = 5144
Kill-9 5144 will kill Tomcat completely.


Ubuntu under the Tomcat Monitor running progress method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.