I want to stop Tomcat using Jenkins. Tomcat is running as a separate application server, I want to restart it using the Jenkins console.
Easiest way to do that would be to ssh from Jenkins to your application server and then run the command to restart your Jenkins. You can either just write down the command inside an "Execute Shell" step, or use a plugin, like this one: https://wiki.jenkins.io/display/JENKINS/SSH+plugin
It’s possible to use Publish Over SSH Plugin. Lets set up ssh connection details in the settings interface of Jenkins. We assign server a name, an address, user’s name and authorization way — by password, passphrase orindicatedcate key. These adjustments are simple and easy. You may found more details the on plugin’s page.
After Install Plugin Add remote server
After Add remote server you can find in Build section Send file or Execute command over SSH
Here you can write command for Tomcat start/stop/restart
for more details visit this URL: https://medium.com/@weblab_tech/how-to-publish-artifacts-in-jenkins-f021b17fde71