We are using Hudson as CI tool. Our requirement is such that, If the build is successfull in hudson, we want to deploy the application war to a tomcat service.
The tomcat service and Hudson are running on different machines (devserver2 and devserver1 respectively) in the same network. For this purpose, I have created an ant script which stops the tomcat service, copy the war in the webapp directory and then start the tomcat service again.
The ant script I have written are like this (only stop and start service targets are mentioned here).