#!/bin/sh
## /public/scripts/CCBuildUnix.sh
## A Script to perform the required actions on Unix machine for
## CC build completion
## Two input parameters are required:
## 1. The release name
##
if [ $# -lt 1 ]; then
echo "Usage: $0 release-name"
echo "Example: $0 Build1.8.4"
exit 1
fi
RELNAME=$1
### How can I know if a host is weblogic server ?
HOSTN=`hostname`
if [ $HOSTN != "barbaree" -a $HOSTN != "avazi" ]
then
echo ""
echo "This script can be run just from Weblogic servers: avazi or barbaree"
echo "Exit..."
echo ""
exit 1
fi
if [ $USER != "weblogic" ]
then
echo ""
echo "Run this program using login weblogic only. Exit..."
echo ""
exit 1
fi
CLASSESDIR=$HOME/classes
if [ -d $CLASSESDIR ]
then
cd $CLASSESDIR
else
echo ""
echo $CLASSESDIR" is not exist. Exit..."
echo ""
exit 1
fi
## Copy new classes from temporary location to permanent loaction on weblogic
## server
echo "Remove old classes from weblogic server"
rm -rf $CLASSESDIR/globecom
echo "copy new classes to weblogic server"
cp -r /public/ins/Java/globecom $CLASSESDIR
echo "remove dependency files"
find $CLASSESDIR/globecom -name "*.dependency" -exec rm -f "{}" \;
## Deploy
echo "deploy......"
echo ""
cd $HOME
pwd
/public/scripts/deploy.sh
## packaging the classes
echo "Packaging classes into tar file"
cd $CLASSESDIR
SUNTARFILE="/public/ins/JavaClasses-SUN-Rel-"$RELNAME".tar"
LNXTARFILE="/public/ins/JavaClasses-LNX-Rel-"$RELNAME".tar"
INTLTARFILE="/public/ins/JavaClasses-INTL-Rel-"$RELNAME".tar"
rm -f $SUNTARFILE $LNXTARFILE $INTLTARFILE
tar cvf $SUNTARFILE ./globecom
echo "Compressing tar file"
cd /public/ins
gzip $SUNTARFILE
echo "duplicate gzip file to LNX and INTL"
cp $SUNTARFILE.gz $LNXTARFILE.gz
cp $SUNTARFILE.gz $INTLTARFILE.gz
exit 0