Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

start/stop tomcat using maven

Tags:

maven-2

ant

How can i start/stop remote tomcat using maven. I am using cargo plugin which helps me in deploying the application , but doesn't provides the functionality to start/stop the remote tomcat.

like image 1000
Pratik Garg Avatar asked Nov 05 '09 14:11

Pratik Garg


2 Answers

Indeed, You can NOT start and stop Tomcat running remotely using Cargo, only deploy and undeploy your web application.

Actually, to my knowledge, there is currently nothing allowing to do this out of the box.

As explained here, the only way to make server "A" start or stop a service like Tomcat when the request comes from client "B" is that yet-another service needs to be available and already running on server "A". [...] and I don't know if such a service is available.

In this message, someone is describing such a solution (based on a socket listener) that you could maybe use (by doing some telnet through maven) but the message is quite old so it's likely outdated and the link pointing to the code seems to be dead. I didn't check out the whole thread, maybe there are other ideas.

If you are using windows, remote service sharing is another possible solution as described here. But, again, this would require some work on your side.

like image 105
Pascal Thivent Avatar answered Oct 21 '22 10:10

Pascal Thivent


From a security standpoint, it's only possible in this way...

Linux: use an SCP or script via SSH Client (putty), then '$CATALINA_HOME/bin/shutdown.sh'

Windows: use sc command, like "sc \192.168.10.10 stop tomcat6"

Quick and clean!

like image 28
Wanderson Santos Avatar answered Oct 21 '22 12:10

Wanderson Santos