在陌生Linux环境查看Tomcat服务的方法
1.查看Tomcat进程
执行命令$ps -ef|grep tomcat 你就能找出tomcat占据的进程号,当然这要求tomcat启动了。
# ps -ef | grep tomcat
root 4637 1 0 Aug08 ? 00:02:01 /opt/ibm/java-x86_64-60/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat-6.0.32/conf/logging.properties -Dorg.apache.geronimo.jaxws.builder.useSimpleFinder=true -Xms1000m -Xmx1500m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache-tomcat-6.0.32/endorsed -classpath /opt/apache-tomcat-6.0.32/bin/bootstrap.jar -Dcatalina.base=/opt/apache-tomcat-6.0.32 -Dcatalina.home=/opt/apache-tomcat-6.0.32 -Djava.io.tmpdir=/opt/apache-tomcat-6.0.32/temp org.apache.catalina.startup.Bootstrap start
root 30152 27548 0 01:32 pts/0 00:00:00 grep tomcat
2.查看Tomcat占据的端口
执行命令$netstat -nat能列出tomcat占据的端口,8080及其它类似的端口是需要注意的。这命令也需要Tomcat启动了。
netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:60000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:523 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:877 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:51343 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:785 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:946 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5811 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5911 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 9.47.228.61:443 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6011 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN
tcp 0 0 9.47.228.61:60000 9.47.228.61:33664 ESTABLISHED
tcp 0 0 9.47.228.61:60000 9.47.228.61:53605 ESTABLISHED
tcp 0 0 9.47.228.61:60000 9.47.228.61:51221 ESTABLISHED
3.查看tomcat所在目录
执行命令#find / -name tomcat,系统将列出所有tomcat为名的目录,进入目录后就能查清楚了。同理可以用find / -name startup.sh去找tomcat启动文件。
# find / -name tomcat
/home/rttsInstall/temp/repository/org/apache/geronimo/ext/tomcat
/home/rttsInstall/temp/repository/org/apache/tomcat
/root/.ivy2/cache/tomcat
find: /proc/30540: No such file or directory
/ntcir/home/rttsInstall/packages/rtts/repository/org/apache/geronimo/ext/tomcat
/ntcir/home/rttsInstall/packages/rtts/repository/org/apache/tomcat
/ntcir/home/hwan/tomcat