I have a Tomcat service running on a remote server. What i would like to do is run a script so that it will stop the tomcat service, check to make sure it is stopped, then remove my war file and replace it with the latest version.
I have this working for the most part, my struggle is verifying that the service is stopped.
My initial thought was to do if then else, but i'm not sure how to send that command through ssh. i dont think its possible.
so here is what i do now.
ssh admin@$BOX.com "/bin/Tomcat7.sh stop"
ssh admin@$BOX.com "ps auxww | grep $TOMCAT
ssh admin@$BOX.com "rm /webapps/console.war"
scp -p /builds/$BUILD/console.war admin@$BOX.com:/webapps/console.war
ssh admin@$BOX.com "bin/Tomcat7.sh start; tail -100f /logs/catalina-daemon.out"
I have ssh password-less setup, so i need a way to verify that the tomcat service is stopped before trying to remove and copy the new file.