Thursday, January 3, 2013

Deployment Script

Deployment of Applications Manually(In Unix Boxes):

Steps involved in doing manual deployment:
Step 1 : Navigate to the application deployment directory.
Step 2 : Take backup of the application before doing the new deployment
Step 3 : Download the bundled tar file from the given link using wget[Non-interactive network downloader].
Step 4 : Cache and temporary file Clearance.

A Bash script to do the manual deployment:

# FileName: Manual_Deployment.sh
#!/bin/bash
#Script is used to perform the maual deployment
#Input : Application Package Link
#Steps Involved:
#1->Navigate to the application directory.(/opt/google/Development/app/IndustryVertical//)
#2->Take the backup of the old application folder.(IndustryVertical-today's date)
#3->Create new IndustryVertical Directory and navigate to it.(IndustryVertical)
#4->Using wget download the package from the given URL.
#5->Perform Cache Clearance.
clear
#step 1
APP_DIR=/opt/google/Development/app/IndustryVertical
cd ${APP_DIR}
#step 2
TODAY_DATE=`date +%d%B`
mv IndustryVertical IndustryVertical-$TODAY_DATE
#step 3
mkdir IndustryVertical
cd IndustryVertical
#step 4
wget $1
mv IndustryVertical.tar.zip IndustryVertical.tar
tar -xvf IndustryVertical.tar
sleep 30
#step 5
DOMAIN_HOME=/opt/google/Oracle/Middleware/user_projects/domains/
DOMAIN_NAME=IndustryVertical
SERVER_DIR=${DOMAIN_HOME}/${DOMAIN_NAME}/servers
cd ${SERVER_DIR}
NO_OF_SERVERS=$(cat /home/google/test_scripts/servers.txt|wc -l)
i=1
 while [ $i -le $NO_OF_SERVERS ]
  do
        SERVER_NAME=$(cat /home/google/test_scripts/servers.txt|tr '\n' ':'|cut -d":" -f$i)
         echo "Cache and Temp Clearance is in Progress for ${SERVER_NAME}"
         rm -r ${SERVER_NAME}/cache/diagnostics
         rm -r ${SERVER_NAME}/cache/EJBCompilerCache
         rm -r ${SERVER_NAME}/tmp/${SERVER_NAME}.lok
         rm -r ${SERVER_NAME}/tmp/WebServiceUtils.ser
         rm -r ${SERVER_NAME}/tmp/_WL_internal
         rm -r ${SERVER_NAME}/tmp/_WL_user
         i=`expr $i + 1`
 done

exit 1

No comments:

Post a Comment