1:找到tomcat安装路径
[root@localhost ~]# cd .. (返回上一级目录)
[root@localhost /]# ls
bin
boot
[root@localhost /]# cd var
[root@localhost var]# ls
account
arpwatch
cache
(看来不在var文件夹中,只能返回上一级目录)
[root@localhost var]# cd ..
[root@localhost /]# cd usr
[root@localhost usr]# ls
2.sql
etc
apache-tomcat-7.0.14.tar
bin
[root@localhost usr]# cd tomcat7.0
[root@localhost tomcat7.0]# ls
bin
conf
[root@localhost tomcat7.0]# cd bin
[root@localhost bin]# ls
bootstrap.jar
catalina.bat
catalina.sh
catalina-tasks.xml
commons-daemon.jar
commons-daemon-native.tar.gz
[root@localhost bin]# ./ (当前目录,这里是做什么用的,不太清楚。。。)
-bash: ./: is a directory
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE:
Using CATALINA_HOME:
Using CATALINA_TMPDIR: /usr/tomcat7.0
Using JRE_HOME:
Using CLASSPATH:
启动成功
2:查看tomcat的日志
[root@localhost bin]# cd ..
[root@localhost tomcat7.0]# ls
bin
conf
[root@localhost tomcat7.0]# cd logs
[root@localhost logs]# ls
catalina.2011-05-30.log
catalina.out
host-manager.2011-05-30.log
(没用的不贴了)
[root@localhost logs]# tail -f catalina.out
ps:Linux下Tomcat的启动、关闭、杀死进程
cd /java/tomcat
#执行
bin/startup.sh #启动tomcat
bin/shutdown.sh #停止tomcat
tail -f logs/catalina.out #看tomcat的控制台输出;
#看是否已经有tomcat在运行了
ps -ef |grep tomcat
#如果有,用kill;
kill -9 pid #pid 为相应的进程号
例如 ps -ef |grep tomcat 输出如下
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
则 5144 就为进程号 pid = 5144
kill -9 5144 就可以彻底杀死tomcat
#直接查看指定端口的进程pid
netstat -anp|grep 9217
#结果为 tcp
LISTEN
#则26127为9217这个端口的tomcat进程的pid,然后就可以kill这个进程
kill -9 26127
#然后再启动tomcat即可