Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

curl - Tomcat manager remote deploy script

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).

question from:https://stackoverflow.com/questions/4432684/tomcat-manager-remote-deploy-script

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 targetdebug.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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...