Can you write Unix/linux shell (bash) script and name it deploy so that when I type deploy inside the terminal on my local desktop pc (which is also linux -- fedora), the application is compiled and deployed to remote server. Assume log to remote server as root with password 'tptp6767' and ip address 123.123.123.123. Here are the sequence of commands that must run in the following order and a given command must complete before running the next command and also stop running the remaining commands if any command is not run successfully or throws error.
# these commands run locally
jvc clean
jvc prod war test.war
<login to remote server using ssh, cannot use telnet or ftp>
<upload ~/projects/test.war to remote server dir /root/uploads>
# these are run on remote server
/etc/init.d/tomcat stop
rm -rf /usr/local/tomcat/webapps/
ROOT/*
cd /usr/local/tomcat/webapps/
ROOT
jar -xvf /root/uploads/test.war
/etc/init.d/tomcat start
Start Free Trial