Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

#!/bin/bash

# Deploy the war

#sh $TOMCAT_HOME/bin/shutdown.sh

pkill -9 -f tomcat
echo "deleting old profitmandi-web.war profitmandi-web directory";
echo "deleting old profitmandi-admin.war profitmandi-admin directory";
echo "deleting old profitmandi-fofo.war profitmandi-fofo directory";

`rm -rf $TOMCAT_HOME/webapps/profitmandi-web*`;
if [ $? -ef 0 ]; then
        echo "profitmandi-web.war and profitmandi-web directroy has been removed successfully.";
else
        echo "profitmandi-web.war and profitmandi-web directroy deletion failed.";
fi 

`rm -rf $TOMCAT_HOME/webapps/profitmandi-admin*`;
if [ $? -ef 0 ]; then
        echo "profitmandi-admin.war and profitmandi-admin directroy has been removed successfully.";
else
        echo "profitmandi-admin.war and profitmandi-admin directroy deletion failed.";
fi

`rm -rf $TOMCAT_HOME/webapps/profitmandi-fofo*`;
if [ $? -eq 0 ]; then
        echo "profitmandi-fofo.war and profitmandi-fofo directory has been removed successfully.";
        echo "profitmandi-fofo.war is deploying... to tomcat container";
        cp build/libs/profitmandi-fofo-0.0.1-SNAPSHOT.war $TOMCAT_HOME/webapps/profitmandi-fofo.war
        if [ $? -eq 0 ]; then
                echo "profitmandi-fofo.war has been deployed successfully.";
                echo "freshing the catalina.out file";
                >$TOMCAT_HOME/logs/catalina.out;
                if [ $? -eq 0 ]; then
                        echo "catalina.out has been refreshed.";
                fi
                echo "tomcat container is being starting...";
                sh $TOMCAT_HOME/bin/startup.sh
                if [ $? -eq 0 ]; then
                        echo "tomcat container has been started successfully.";
                        echo "opening application logs";
                        #tail -f /home/ashikali/apache-tomcat-8.0.43/logs/catalina.out
                        tail -f $TOMCAT_HOME/logs/catalina.out
                else
                        echo "tomcat container is failed to start";
                fi
        else 
                echo "profitmandi-fofo.war deployment failed.";
        fi
else 
        echo "profitmandi-fofo.war or profitmandi-fofo directory deletion failed.";
fi