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-api.war profitmandi-api directory";
echo "deleting old profitmandi-admin.war profitmandi-admin directory";

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

`rm -rf $TOMCAT_HOME/webapps/profitmandi-admin*`;
if [ $? -eq 0 ]; then
        echo "profitmandi-admin.war and profitmandi-admin directory has been removed successfully.";
        echo "profitmandi-admin.war is deploying... to tomcat container";
        cp target/profitmandi-admin-0.0.1-SNAPSHOT.war $TOMCAT_HOME/webapps/profitmandi-admin.war
        if [ $? -eq 0 ]; then
                echo "profitmandi-admin.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/catalina.sh start
                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
                else
                        echo "tomcat container is failed to start";
                fi
        else 
                echo "profitmandi-admin.war deployment failed.";
        fi
else 
        echo "profitmandi-admin.war or profitmandi-admin directory deletion failed.";
fi