3

目的是:

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 
4

1 回答 1

6

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

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

如果您对服务器具有 ssh 访问权限,那么您可能需要考虑JSch 库,您可以将其与SSHExec Ant Task结合使用来启动和停止服务器:

<sshexec host="somehost"
    username="dude"
    password="yo"
    command="/etc/init.d/tomcat restart"/>
于 2012-05-03T13:44:32.337 回答