在Linux系统下,停止和重启Tomcat使用命令操作的!
首先,进入Tomcat下的bin目录
[root@localhost ~]#cd /usr/local/tomcat/bin #安装tomcat的路径各有不同,查看根据实际路径访问
使用Tomcat关闭命令
[root@localhost bin]#./shutdown.sh
查看Tomcat是否以关闭
ps -ef|grep java ps -ef|grep tomcat #两种方式都可以
如果显示以下相似信息,说明Tomcat还没有关闭
[root@localhost bin]# ps -ef|grep tomcat
root 15559 1 1 09:01 pts/4 00:00:03 /usr/local/jdk/jre/bin/java -Djava.util.logging.config.file=/data/tomcat_test/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.library.path=/usr/local/apr/lib -Djava.endorsed.dirs=/data/tomcat_test/endorsed -classpath /data/tomcat_test/bin/bootstrap.jar:/data/tomcat_test/bin/tomcat-juli.jar -Dcatalina.base=/data/tomcat_test -Dcatalina.home=/data/tomcat_test -Djava.io.tmpdir=/data/tomcat_test/temp org.apache.catalina.startup.Bootstrap start
root 15600 19558 0 09:06 pts/4 00:00:00 grep tomcat
*如果你想直接干掉Tomcat,你可以使用kill命令,直接杀死Tomcat进程
[root@localhost bin]#kill -9 15559
然后继续查看Tomcat是否关闭
ps -ef|grep java ps -ef|grep tomcat
如果出现以下信息,则表示Tomcat已经关闭
[root@localhost bin]# ps -ef|grep tomcat
root 15602 19558 0 09:08 pts/4 00:00:00 grep tomcat
最后,启动Tomcat
[root@localhost bin]#./startup.sh
查看Tomcat是否正常启动,看日志 cd /usr/local/tomcat/logs
tail -f catalina.out
[root@localhost logs]# tail -f catalina.out
Jul 20, 2017 9:11:11 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /data/tomcat_test/webapps/ROOT has finished in 23 ms
Jul 20, 2017 9:11:11 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /data/tomcat_test/webapps/shopmgr
Jul 20, 2017 9:11:11 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /data/tomcat_test/webapps/shopmgr has finished in 28 ms
Jul 20, 2017 9:11:11 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 20, 2017 9:11:11 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4752 ms #没有报错,表示已经正常启动了
网友评论