-->

如何连接到远程服务器,并启动/停止目前正使用Ant的那个特定的服务器上运行的Tomcat?(How

2019-07-29 06:02发布

目的是:

1: connect to a remote server maybe via host: ip , port: 8181
2: stop Tomcat that's running on that server 
3: deploy a .war file 
4: restart tomcat 

Answer 1:

我相信Tomcat文档下的监测和管理Tomcat完全提供了关于如何停止给定应用程序的一些信息,但不是服务器:

<jmx:invoke
    name="Catalina:type=Manager,path=/servlets-examples,host=localhost" 
    operation="stop"/>

如果你有服务器的SSH访问,那么你可能要考虑的JSch库 ,你可以结合使用与SSHExec Ant任务来启动和停止服务器:

<sshexec host="somehost"
    username="dude"
    password="yo"
    command="/etc/init.d/tomcat restart"/>


文章来源: How to connect to remote server and start/stop the Tomcat that's running on that particular server using Ant?