简体   繁体   English

如何使用Ant连接到远程服务器并启动/停止在该特定服务器上运行的Tomcat?

[英]How to connect to remote server and start/stop the Tomcat that's running on that particular server using Ant?

The purpose is to: 目的是:

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 

I believe Tomcat Documentation under Monitoring and Managing Tomcat offers some information on how to stop a given application, but not the server entirely: 我相信监控和管理Tomcat下的Tomcat文档提供了一些有关如何停止给定应用程序但不完全停止服务器的信息:

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

If you have ssh access to the server, then you might like to consider the JSch library which you can use in combination with SSHExec Ant Task to start and stop your server: 如果您具有对服务器的ssh访问权限,那么您可能会考虑将JSch库SSHExec Ant Task结合使用来启动和停止服务器:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM