在 Linux 中检查 Tomcat 服务器的状态

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10173151/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:49:04  来源:igfitidea点击:

To check status of Tomcat server in Linux

linuxapachetomcattomcat7

提问by Nabe

I need to know whether Tomcat 7.0.2.3 is on or not.

我需要知道 Tomcat 7.0.2.3 是否开启。

I got an error page that shows this message:

我收到一个显示此消息的错误页面:

HTTP Status 404 - /cas/login

type Status report

 message /cas/login

description The requested resource (/cas/login) is not available.
 Apache Tomcat/7.0.23

I need to check the status and start the service of Tomcat in Linux. I have tried:

我需要在Linux中检查状态并启动Tomcat的服务。我试过了:

#/bin/startup.sh
#rctomcat7 start

But all these are not working.

但所有这些都不起作用。

回答by souser

Like others have pointed out, if you are receiving an HTTP standard response code of 404then it means that Tomcat is up.

就像其他人指出的那样,如果您收到404HTTP 标准响应代码,则意味着 Tomcat 已启动。

But to answer your question, you can try

但是要回答您的问题,您可以尝试

 #rctomcat7 status

回答by chetan parmar

I have used below script. This script check tomcat post and process is running up or not,if not then start the tomcat.

我使用了下面的脚本。这个脚本检查tomcat post和进程是否正在运行,如果没有则启动tomcat。

Tomcat 启动脚本
if netstat -tulpen | grep 18880 && ps -ef | grep tomcat | grep java

then

    echo "Tomcat Running"

else

    echo "Tomcat Stopped"

    /bin/sh /tomcat/bin/startup.sh

fi