Tomcat管理器远程部署脚本 [英] Tomcat manager remote deploy script

查看:267
本文介绍了Tomcat管理器远程部署脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用tomcat管理器编写一个shell脚本来自动部署/取消部署。



按照 http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely ,我使用curl进行部署

  curl --anyauth -u用户名:pwd -d path = / something -d war = file:target / someWar.war https://someurl.com/manager/deploy 

得到响应说HTTP方法POST不支持这个URL。



所以我改变我的curl是一个使用-G

  curl --anyauth -u用户名:pwd -G -d path = / something -d war = file:target / someWar.war https://someurl.com / manager / deploy 

我得到一个FAIL的响应 - 未能在上下文路径/它似乎是在服务器上而不是我的机器本地查找文件。有些pluings可以远程部署,而不必scp文件,所以我想知道我错过了什么。



我目前在想法't看到tomcat管理器配置页上的任何其他选项)。

解决方案

这种方式在我的Tomcat 6

  curl --upload-file< path to warfile> http://   

示例:

  --upload-file target\debug.warhttp:// tomcat:tomcat @ localhost:8088 / manager / deploy?path = / debug& update = true
pre>

很容易peasy。输出如下:

 确定 - 在上下文路径/ debug下部署的应用程序
确定 - 在上下文路径部署的应用程序/ debug


I'm writing a shell script to auto deploy/undeploy using the tomcat manager.

Following the instructions on http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely, I use curl for my deployment

curl --anyauth -u username:pwd -d path=/something -d war=file:target/someWar.war https://someurl.com/manager/deploy

And I get the response saying HTTP method POST is not supported by this URL.

So I change my curl to be a get using -G

curl --anyauth -u username:pwd -G -d path=/something -d war=file:target/someWar.war https://someurl.com/manager/deploy

I get a response of FAIL - Failed to deploy application at context path /something and it seems to be looking for the file locally on the server instead of my machine. There are pluings which do remote deploy without having to scp the file over so I'm wondering what I'm missing.

I'm currently out of ideas (I don't see any other option on the tomcat manager configuration page).

解决方案

This way is working for me on Tomcat 6 (See jevelopers answer for tomcat 7):

curl --upload-file <path to warfile> "http://<tomcat username>:<tomcat password>@<hostname>:<port>/manager/deploy?path=/<context>&update=true"

Example:

curl --upload-file target\debug.war "http://tomcat:tomcat@localhost:8088/manager/deploy?path=/debug&update=true"

Very easy peasy. Output is like this:

OK - Undeployed application at context path /debug
OK - Deployed application at context path /debug

这篇关于Tomcat管理器远程部署脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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