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.
You can try to use the maven tomcat plugin or if it does not give you everything you need, you can always use an ant task here is a reference on the task
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.
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!