Remote starting/stopping Tomcat from Jenkins I like to stop Tomcat before redeployment, manually clean out the old wars and all the logs, then restart the server. To do that from Jenkins, I have been using the SSH plugin and call sudo service tomcat stop/start and it works... sometimes. Other times the stop works but it fails to restart but the job still erroneously succeeds.

Is there an alternative to restarting Tomcat to SSH, especially when invoked from Jenkins. E.g. can I set up something like xinetd to make these admin functins somewhat of web services. Automating SSH connection from Jenkins is sort of a crapchute.
If you install the manager webapp with a default set up of tomcat then it is possible to use this to install and restart applications, see 

https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Reload_An_Existing_Application

I feel that you are asking the wrong question however.  The problem is not how to restart Tomcat but how to be sure that it has restarted

Set a host, tomcat_port and check path then use shell code like this

while [ "$response_code" != "200" ]
do
        echo "Checking whether tomcat (${host}:${tomcat_port}/$check) is alive..."
        response_code=`curl -sL -w "%{http_code}" "http://${host}:${tomcat_port}/${check}" -o /dev/null`
        echo "Received response code $response_code"
        if [ "$response_code" != "200" ]
        then
                echo "Waiting for a bit..."
                sleep 15s
        fi;
done;
echo "Tomcat is alive!"


This will wait until the Tomcat comes back - or the containing Jenkins job will time out eventually