如何使用 Ant 连接到远程服务器并启动/停止在该特定服务器上运行的 Tomcat? [英] How to connect to remote server and start/stop the Tomcat that's running on that particular server using Ant?

查看:30
本文介绍了如何使用 Ant 连接到远程服务器并启动/停止在该特定服务器上运行的 Tomcat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 

推荐答案

我相信 Tomcat 文档监控和管理 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:

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

如果您可以通过 ssh 访问服务器,那么您可能需要考虑 JSch 库,您可以结合使用它使用 SSHExec Ant Task 来启动和停止您的服务器:

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:

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

这篇关于如何使用 Ant 连接到远程服务器并启动/停止在该特定服务器上运行的 Tomcat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆