`
xifengtaizi
  • 浏览: 11314 次
  • 性别: Icon_minigender_2
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

gbuild.sh

    博客分类:
  • UNIX
 
阅读更多

ME=gbuild.sh

#echo - Check for updates ......
if [ /home/sh13256/$ME -nt $0 ]; then
#  echo - New version found. Update ...
  cp /home/sh13256/$ME $0
  echo - $0 Updated. Relaunching ...
  echo
  echo "$0 $*"
  $0 $*
  exit
fi
#echo - $0 is up to date

CMD=$1
gROOT=`pwd`
gJAVA=/home/sh13256/j2se/1.5.0_12/bin/java
LOG_FOLDER=logs
COMPILE=Compile
TO=${gROOT}/To

ARCHIVE_PATH=${gROOT}/archive
GOLLF_ARCHIVE=archiveGollf

COMPS_COMPILE_BACK=compsCompile/comps/backend

GOLLF_HERMES=gollfHermes

GOLLF_CLIENT=clientCompile
CLIENT_ZIP_NAME=GollfClient.zip
CLIENT_ZIP=/home/sh13256/GollfWork/${CLIENT_ZIP_NAME}

USER_PROJ=/opt/apps/weblogic/9.2/user_projects
ELV_DOMAIN=${USER_PROJ}/elvDomain

COMPS_TEST=compsTest

WL_92_MP2=/export/opt/bea/9.2_MP2
WL_92_MP1=/export/opt/bea/9.2_MP1

#dev3d
WL_92=${WL_92_MP1}
WLST=/home/sh13256/GollfWork/cmd/wlst_92MP1.sh

#if [ -d ${WL_92_MP2} ]; then
#   WL_92=${WL_92_MP2}
#dev2d
#   WLST=${WL_92}/weblogic92/common/bin/wlst.sh
#fi


if [ ! -d ${gROOT}/${LOG_FOLDER} ]; then
  mkdir ${gROOT}/${LOG_FOLDER}
  chmod -R 777 ${gROOT}/${LOG_FOLDER}
fi

removeFolderQuickly(){
  rm -f ./build
  cp /home/sh13256/build.sh build
  chmod +x ./build
  ./build rm ${1}
  rm -f ./build
}

echoToFile(){
FILE_NAME=${1}
TEXT=${2}

echo ${2} >> ${1}
}

sendMail(){
#  #set -x

  TOLIST=`echo shangshang.hu@iuo.citi.com`
  MY_MAIL=$TOLIST
  if [ -f $TO ]; then
    TOLIST=`cat $TO | tr '\n' ' '`
  elif [ -f /home/sh13256/To ]; then
    TOLIST=`cat /home/sh13256/To | tr '\n' ' '`
  fi

  echo "    --------- Send Mail Start ---------"

  echo "      Subject : $1"
  echo "       Attach : $2"
  echo "      Sent to : ${TOLIST}"

  mailx -b $MY_MAIL -t <<EOF
To: $TOLIST
Subject: $1
Mime-Version: 1.0;
Content-Type: text/html; charset="ISO-8859-1";
Content-Transfer-Encoding: 7bit;
<html><body><pre style='font-size:12px; color:003366'>
`cat $2`
</pre></body></html>
EOF

  if [ $? -ne 0 ]; then
    echo "      -- Send Mail Fail ! -- "
  fi

  echo "    --------- Send Mail Finish ---------"

}

updateCVS(){

  FOLDER=${1}

  echo ----------------- Updating CVS ${FOLDER} -----------------

  cd ${gROOT}/
  echo " Branch: "`cat .branch`
  echo " Folder: ${FOLDER}"

  CVS_LOG=${gROOT}/${LOG_FOLDER}/.cvs.log
  rm -f ${CVS_LOG}

  CVSROOT=/net/nasny30v1gfi.nam.nsroot.net/vol/gfi_v1_q1/data/opt/ilink/CVSRepository
  export CVSROOT

  if [ -d ${gROOT}/gollf/${FOLDER} ]; then
      cd ${gROOT}/gollf/${FOLDER}
      cvs -q update -C > ${CVS_LOG} 2>&1
     
      if [ $? = '0' ]; then
        CVS_COUNT=`wc -l ${CVS_LOG} | sed 's/ \/.*$//' | sed 's/ //g'`
        echo " CVS: ${CVS_COUNT} file(s) updated"
     
        if [ ${CVS_COUNT} -le 0  ]; then
            echo " CVS: no updates."
#           exit
        fi
     
        if [ -s ${CVS_LOG} ]; then
          sendMail "GOLLF_CVS" ${CVS_LOG}
        fi
      else
        echo --- update CVS Failed
        exit
      fi
  else
 
    echo "${gROOT}/gollf/${FOLDER} not yet checked out."
    echo "Checking out"
   
    cd ${gROOT}/
    cp /home/sh13256/checkout.sh checkout
    chmod +x checkout
    ./checkout GOLLF - ${FOLDER}

  fi

}

prepareGollfSource(){

  TARGET_FOLDER=${1}
  PKG_NAME=${2}
  FOLDER_NAME=${3}

  echo "----------------- Creating [${TARGET_FOLDER}/${PKG_NAME}/${FOLDER_NAME}] -----------------"

  removeFolderQuickly ${gROOT}/${TARGET_FOLDER}
#  removeFolderQuickly ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/${FOLDER_NAME}
#  removeFolderQuickly ${gROOT}/${TARGET_FOLDER}/common

  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/${FOLDER_NAME}
  cp -R ${gROOT}/gollf/${PKG_NAME}/${FOLDER_NAME} ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}
  cp -R ${gROOT}/gollf/common/ ${gROOT}/${TARGET_FOLDER}/
  cd ${gROOT}/${TARGET_FOLDER}

  find ${gROOT}/${TARGET_FOLDER} -name "CVS" -exec rm -rf {} \;
  chmod -R +xw .

  cd ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/${FOLDER_NAME}
  if [ -f ./prepareSource.ksh ]; then
    ./prepareSource.ksh
    if [ $? = '1' ]; then
      echo Prepare Source Fail
      exit
    fi
  fi

  /home/sh13256/build.sh crlfShallow ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/
  /home/sh13256/build.sh crlfShallow ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/pkg
  /home/sh13256/build.sh crlfShallow ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/scritpts

}

prepareGollfDB(){

  TARGET_FOLDER=${1}
  PKG_NAME=${2}
  CTRL_NAME=${3}

  removeFolderQuickly ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}

  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}
  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db
  cp ${gROOT}/gollf/${PKG_NAME}/db/* ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/
  cp -R ${gROOT}/gollf/${PKG_NAME}/db/cmd ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db
  cp -R ${gROOT}/gollf/${PKG_NAME}/db/config ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db

  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src
  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src/${CTRL_NAME}

  CTRL_FILE=${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/config/${CTRL_NAME}.ctl
  CTRL_LIST=`cat ${CTRL_FILE} | sed '/^#/d' | sed '/^$/d'`

  for CTLFILE in ${CTRL_LIST}
  do
    SUFFIX=`echo ${CTLFILE} | sed 's/^.*\.//'`
    SUFFIX_FOLDER=${SUFFIX}
    if [ SUFFIX=trg -a ! -d ${gROOT}/gollf/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER} ]; then
      SUFFIX_FOLDER=trig
    fi

    if [ ! -d ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER} ]; then
    mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER}
    fi

set -x
    cp ${gROOT}/gollf/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER}/${CTLFILE} ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER}/${CTLFILE}
set +x
  done

#  cp -R ${gROOT}/gollf/${PKG_NAME}/db/ ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}

  /home/sh13256/build.sh crlf ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db
  cd ${gROOT}/${TARGET_FOLDER}
  find . -name "CVS" -exec rm -rf {} \;
  chmod -R +xw .

}

mergeGollfDB(){

  TARGET_FOLDER=${1}
  PKG_NAME=${2}
  CTRL_NAME=${3}
  RESULT_FILE=${4}
 
  removeFolderQuickly ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}

  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}
  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db
  cp ${gROOT}/gollf/${PKG_NAME}/db/* ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/
  cp -R ${gROOT}/gollf/${PKG_NAME}/db/cmd ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db
  cp -R ${gROOT}/gollf/${PKG_NAME}/db/config ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db

  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src
  mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src/${CTRL_NAME}

  CTRL_FILE=${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/config/${CTRL_NAME}.ctl
  CTRL_LIST=`cat ${CTRL_FILE} | sed '/^#/d' | sed '/^$/d'`

  echo "" > ${RESULT_FILE}

  for CTLFILE in ${CTRL_LIST}
  do
    SUFFIX=`echo ${CTLFILE} | sed 's/^.*\.//'`
    SUFFIX_FOLDER=${SUFFIX}
    if [ SUFFIX=trg -a ! -d ${gROOT}/gollf/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER} ]; then
      SUFFIX_FOLDER=trig
    fi

    if [ ! -d ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER} ]; then
        mkdir -p ${gROOT}/${TARGET_FOLDER}/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER}
    fi

    echo ${gROOT}/gollf/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER}/${CTLFILE}

    cat ${gROOT}/gollf/${PKG_NAME}/db/src/${CTRL_NAME}/${SUFFIX_FOLDER}/${CTLFILE} | sed 's/
$//' >> ${RESULT_FILE}
  done

    echo " - "
    echo " - Merged into ${RESULT_FILE}"
}


createTar(){
    PKG_NAME=$1
    FOLDER_NAME=$2
    TAR_FILE=$3
   
    rm ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
    cd ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${FOLDER_NAME}/
    tar cvf ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE} ./*
    compress -f ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}
}

hermesUsage(){
    echo "Usage:"
    echo
    echo "  $0 hermes releasetype [config file]"
    echo
    echo " - or - "
    echo
    echo "  $0 hermes releasetype productname [config file]"
    echo "      releasetype = integration | major | minor | bugfix | resubmission"
    echo "      productname = comps | compsbat | compsdb | ds | dsbat | dsdb | entl | gemfire | scorecard | profile"
    echo
    echo " - or - "
    echo
    echo "  $0 hermesall releasetype productname1 productname2 productname3 ..."
    echo "      releasetype = integration | major | minor | bugfix | resubmission"
    echo "      productname = comps | compsbat | compsdb | ds | dsbat | dsdb | entl | gemfire | scorecard | profile"
    echo
}

hermes(){

    cd ${gROOT}

    RELEASETYPE=$1
    MODULE_NAME=$2
    CUSTOM_CFG=$3
   
    echo ----------------- HERMES ${RELEASETYPE} ${MODULE_NAME} -----------------

    APP_ID=153263

    if [ ! -d ${gROOT}/${GOLLF_HERMES} ]; then
    mkdir ${gROOT}/${GOLLF_HERMES}
    fi

    CFG_FILE=${gROOT}/${GOLLF_HERMES}/gollf.hermes.cfg
    rm -f ${CFG_FILE}

    if [ $MODULE_NAME = 'comps' ]; then

      updateCVS common
      updateCVS comps/backend

      PKG_NAME=comps
      FOLDER_NAME=backend
      PRODUCTNAME=gCompsSrv
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
     
      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo PackageList=gCompsSrv:DSTREAM >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'compsbat' ]; then

      updateCVS common
      updateCVS comps/batch

      PKG_NAME=comps
      FOLDER_NAME=batch
      PRODUCTNAME=gCompsBat
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
     
      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo DeploymentGroup=GDS >> ${CFG_FILE}
      echo EnvFileList=gCompsBat1.env  >> ${CFG_FILE}
      echo PackageList=gCompsBat:DSTREAM >> ${CFG_FILE}
     
    elif [ $MODULE_NAME = 'ds' ]; then

      updateCVS common
      updateCVS ds/backend
     
      PKG_NAME=ds
      FOLDER_NAME=backend
      PRODUCTNAME=gDSSrv
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
     
      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo PackageList=gDSSrv:DSTREAM >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'dsbat' ]; then

      updateCVS common
      updateCVS ds/batch
     
      PKG_NAME=ds
      FOLDER_NAME=batch
      PRODUCTNAME=gDSBatch
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
     
      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo DeploymentGroup=GDS >> ${CFG_FILE}
     
    elif [ $MODULE_NAME = 'compsdb' ]; then

      updateCVS comps/db

      PKG_NAME=comps
      FOLDER_NAME=gCompsDB
      PRODUCTNAME=gCompsDB
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z

      prepareGollfDB ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
     
      rm ${SRCFILE}
      cd ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/db
      /xenv/stexenv -r 43288 . << ZZ
make install -f *.mk
ZZ

      tar cvf ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE} -C ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/db/Deploy .
      compress -f ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo DDL_UATServer=SYNLNU1  >> ${CFG_FILE}
      echo DDL_PRODServer=SYNLNP1  >> ${CFG_FILE}
      echo DDL_AutoInstall=Y  >> ${CFG_FILE}
#      echo DeploymentGroup=1  >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'dsdb' ]; then

      updateCVS ds/db

      PKG_NAME=ds
      FOLDER_NAME=gollf
      PRODUCTNAME=gollfDB
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
     
      prepareGollfDB ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}

      rm ${SRCFILE}
      cd ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/db
/xenv/stexenv -r 48079 . << ZZ
make -f dsdb.mk clobber clean package
ZZ

      DEPLOY_FOLDER=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/db/temp
      mkdir ${DEPLOY_FOLDER}
      cp -r ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/db/Deploy ${DEPLOY_FOLDER}

      tar cvf ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE} -C ${DEPLOY_FOLDER} .
      compress -f ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo DDL_UATServer=SYNLNU1  >> ${CFG_FILE}
      echo DDL_PRODServer=SYNLNP1  >> ${CFG_FILE}
      echo DDL_AutoInstall=Y  >> ${CFG_FILE}
      echo DeploymentGroup=GDMG  >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'entl' ]; then

      updateCVS common
      updateCVS entl/backend

      PKG_NAME=entl
      FOLDER_NAME=backend
      PRODUCTNAME=gEntlSrv
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
     
      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo EnvFileList=gEntlSrv.env  >> ${CFG_FILE}
      echo PackageList=gEntlSrv:DSTREAM >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'gemfire' ]; then

      updateCVS common
      updateCVS gemfire/cache

      PKG_NAME=gemfire
      FOLDER_NAME=cache
      PRODUCTNAME=gGemfSrv
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z
     
      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo EnvFileList=gGemfSrv.env >> ${CFG_FILE}
      echo PackageList=gGemfSrv >> ${CFG_FILE}
      echo DeploymentGroup=GDS >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'profile' ]; then

      updateCVS common
      updateCVS profile/backend

      PKG_NAME=profile
      FOLDER_NAME=backend
      PRODUCTNAME=gProfileSrv
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z

      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo EnvFileList=gProfileSrv.env >> ${CFG_FILE}
      echo PackageList=gProfSrv:DSTREAM >> ${CFG_FILE}
      echo DeploymentGroup=GDS >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'scorecard' ]; then

      updateCVS common
      updateCVS scorecard/backend

      PKG_NAME=scorecard
      FOLDER_NAME=backend
      PRODUCTNAME=gSCSrv
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z

      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo EnvFileList=gSCSrv.env >> ${CFG_FILE}
      echo PackageList=gSCSrv:DSTREAM >> ${CFG_FILE}
      echo DeploymentGroup=GDS >> ${CFG_FILE}

    elif [ $MODULE_NAME = 'refdata' ]; then

      updateCVS common
      updateCVS refdata/backend

      PKG_NAME=refdata
      FOLDER_NAME=backend
      PRODUCTNAME=gRefSrv
      TAR_FILE=${PRODUCTNAME}.tar
      SRCFILE=${gROOT}/${GOLLF_HERMES}/${PKG_NAME}/${TAR_FILE}.Z

      prepareGollfSource ${GOLLF_HERMES} ${PKG_NAME} ${FOLDER_NAME}
      createTar ${PKG_NAME} ${FOLDER_NAME} ${TAR_FILE}

      echo DoAutoDeployment=Y  >> ${CFG_FILE}
      echo EnvFileList=gRefSrv.env >> ${CFG_FILE}
      echo PackageList=gRefSrv:DSTREAM >> ${CFG_FILE}
      echo DeploymentGroup=GDS >> ${CFG_FILE}

    else
      echo " - "
      echo " - No matching Module Name."
      echo " - "
     
      exit 1
    fi

    echo AdditionalEmailList=gcamp.dev.gfi@iuo.ssmb.com,gtlsd@iuo.ssmb.com  >> ${CFG_FILE}
    echo InteractiveMode=N  >> ${CFG_FILE}
    echo IncrementalDelivery=N  >> ${CFG_FILE}
    echo QuietEmail=Y  >> ${CFG_FILE}

    HERMES_CMD=" -P ${PRODUCTNAME} -A ${APP_ID} -R ${RELEASETYPE} -B prod_uat -S ${SRCFILE}"

    if [ $CUSTOM_CFG ]; then
      HERMES_CMD="${HERMES_CMD} -C ${gROOT}/${CUSTOM_CFG}"
    elif [ -f ${CFG_FILE} ]; then
      HERMES_CMD="${HERMES_CMD} -C ${CFG_FILE}"
    fi

    HEREMS_LOG=${gROOT}/${GOLLF_HERMES}/submitToHermes.log
    rm -f ${HEREMS_LOG}
    touch ${HEREMS_LOG}
    tail -f ${HEREMS_LOG} &
    TAIL_PID=$!
    echo "TAIL PID = ${TAIL_PID}"
   
    echo "- /xenv/scripts/bin/SubmitToHermes ${HERMES_CMD}"
    /xenv/scripts/bin/SubmitToHermes ${HERMES_CMD} > ${HEREMS_LOG}

    FORM_ID=`cat ${HEREMS_LOG} | grep Error=129 | sed 's/^.* \"//' | sed 's/\".*$//' | sed 's/,//g'`
    if [ $FORM_ID ]; then
        echo
        echo "---------- Canceling last submition. Form ID: $FORM_ID ----------"
        echo "/xenv/scripts/bin/SubmitToHermes -T cancel -F $FORM_ID"
        /xenv/scripts/bin/SubmitToHermes -T cancel -F $FORM_ID >> ${HEREMS_LOG}
        echo
        echo "---------- Submit Job Again ----------"
        /xenv/scripts/bin/SubmitToHermes $HERMES_CMD >> ${HEREMS_LOG}
    fi

    sendMail "GOLLF_HERMES_${PRODUCTNAME}" ${HEREMS_LOG}
   
    kill -9 ${TAIL_PID}
   
    cd ${gROOT}
    removeFolderQuickly ${gROOT}/${GOLLF_HERMES}/${PKG_NAME}
   
}

checkFolder(){
  FOLDER_NAME=${1}
  if [ ! -d ${FOLDER_NAME} ]; then
    mkdir ${FOLDER_NAME}
    chmod -R 777 ${FOLDER_NAME}
  fi
}

buildGollf(){

  PKG_NAME=${1}
  SRC_FOLDER=${2}
  ENV_ID=${3}
  MK_FILE=${4}
  ARC_FILE_NAME=${5}

  WORK_FOLDER=${PKG_NAME}Compile
  BUILD_FOLDER=${WORK_FOLDER}/${PKG_NAME}/${SRC_FOLDER}
  LOG_FILE=${gROOT}/${LOG_FOLDER}/.${PKG_NAME}.log

  prepareGollfSource ${WORK_FOLDER} ${PKG_NAME} ${SRC_FOLDER}

  rm ${LOG_FILE}
  touch ${LOG_FILE}
  tail -f ${LOG_FILE} &
  TAIL_PID=$!
  echo "TAIL PID = ${TAIL_PID}"

  echo ----------------- Building ${PKG_NAME} -----------------
  cd ${gROOT}/${BUILD_FOLDER}
/xenv/stexenv -r ${ENV_ID} . << ZZ > ${LOG_FILE} 2>&1
make package -f ${MK_FILE}
ZZ

  kill -9 ${TAIL_PID}
  chmod 777 ${gROOT}/${LOG_FOLDER}/.* &

}

archiveGollfEar(){

  PKG_NAME=${1}
  SRC_FOLDER=${2}
  ARC_FILE_NAME=${3}

  WORK_FOLDER=${PKG_NAME}Compile
  BUILD_FOLDER=${WORK_FOLDER}/${PKG_NAME}/${SRC_FOLDER}
  LOG_FILE=${gROOT}/${LOG_FOLDER}/.${PKG_NAME}.log

  echo ----------------- Archiving ${ARC_FILE_NAME} -----------------

  currdate=`date '+%m%d%H%M%S'`
  cd ${gROOT}
 
  find ${ARCHIVE_PATH} -mtime +3 -exec rm -rf {} \;
  checkFolder ${ARCHIVE_PATH}

  if [ -f ${gROOT}/${BUILD_FOLDER}/install/applications/${ARC_FILE_NAME} ]; then
    mv ${ARCHIVE_PATH}/${ARC_FILE_NAME} ${ARCHIVE_PATH}/${ARC_FILE_NAME}.${currdate}
    mv ${gROOT}/${BUILD_FOLDER}/install/applications/${ARC_FILE_NAME} ${ARCHIVE_PATH}/${ARC_FILE_NAME}
    echo --- archived at ${ARCHIVE_PATH}/${ARC_FILE_NAME}
    #.${currdate}
    chmod -R 777 ${ARCHIVE_PATH}

    echo --- archived at ${ARCHIVE_PATH}/${ARC_FILE_NAME}.${currdate} >> ${LOG_FILE}
    sendMail "GOLLF_${ARC_FILE_NAME}_SUCCESS" ${LOG_FILE}

    cd ${gROOT}
#    removeFolderQuickly ${gROOT}/${WORK_FOLDER}
  else
    sendMail "GOLLF_${ARC_FILE_NAME}_FAIL" ${LOG_FILE}
  fi
 
}

archiveGollfDstream(){

  PKG_NAME=${1}
  SRC_FOLDER=${2}
  ARC_FILE_NAME=${3}

  WORK_FOLDER=${PKG_NAME}Compile
  BUILD_FOLDER=${WORK_FOLDER}/${PKG_NAME}/${SRC_FOLDER}
  LOG_FILE=${gROOT}/${LOG_FOLDER}/.${PKG_NAME}.log

  echo ----------------- Archiving ${ARC_FILE_NAME} -----------------

  find ${ARCHIVE_PATH} -mtime +3 -exec rm -rf {} \;
  currdate=`date '+%m%d%H%M%S'`
  cd ${gROOT}

  checkFolder ${ARCHIVE_PATH}

  if [ -f ${gROOT}/${BUILD_FOLDER}/${ARC_FILE_NAME} ]; then
    mv ${ARCHIVE_PATH}/${ARC_FILE_NAME} ${ARCHIVE_PATH}/${ARC_FILE_NAME}.${currdate}
    mv ${gROOT}/${BUILD_FOLDER}/install/applications/${ARC_FILE_NAME} ${ARCHIVE_PATH}/${ARC_FILE_NAME}
    echo --- archived at ${ARCHIVE_PATH}/${ARC_FILE_NAME}#.${currdate}
    chmod -R 777 ${ARCHIVE_PATH}

    echo --- archived at ${ARCHIVE_PATH}/${ARC_FILE_NAME}.${currdate} >> ${LOG_FILE}
    sendMail "GOLLF_${ARC_FILE_NAME}_SUCCESS" ${LOG_FILE}
   
    cd ${gROOT}
#    removeFolderQuickly ${gROOT}/${WORK_FOLDER}
  else
    sendMail "GOLLF_${ARC_FILE_NAME}_FAIL" ${LOG_FILE}
  fi
 
  chmod 777 ${gROOT}/${LOG_FOLDER}/.* &
}

prepareClient(){
  removeFolderQuickly ${gROOT}/${GOLLF_CLIENT}

  mkdir ${gROOT}/${GOLLF_CLIENT}
  cp -R ${gROOT}/gollf/client/ ${gROOT}/${GOLLF_CLIENT}/
  cd ${gROOT}/${GOLLF_CLIENT}
  find . -name "CVS" -exec rm -rf {} \;
  chmod -R 777 .
}

unzipClient(){
  cp ${CLIENT_ZIP} ${gROOT}/${GOLLF_CLIENT}/client
  cd ${gROOT}/${GOLLF_CLIENT}/client
  unzip ${CLIENT_ZIP_NAME}
  rm -rf ${gROOT}/${GOLLF_CLIENT}/client/${CLIENT_ZIP_NAME}
}

restartServer(){
  set -x

  APPLICATION_NAME=$1
  SERVER_NAME=$2
  REDEPLOY_LOG=${gROOT}/${LOG_FOLDER}/.restart.${APPLICATION_NAME}.log

  echo "/export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -Action Stop" > ${REDEPLOY_LOG}
  echo "/export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -Action Start" >> ${REDEPLOY_LOG}

  if [ -z ${SERVER_NAME} ]; then
    sendMail "GOLLF_emt_${APPLICATION_NAME}_Restarting" ${REDEPLOY_LOG}
    /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -Action Stop > ${REDEPLOY_LOG} 2>&1
    /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -Action Start >> ${REDEPLOY_LOG} 2>&1
   
    ERROR=`tail -10 ${REDEPLOY_LOG} | grep "EMT Failed."`
    echo ${ERROR}
    if [ ! -z ${ERROR} ]; then
    sendMail "GOLLF_emt_${APPLICATION_NAME}_Restarted_FAIL" ${REDEPLOY_LOG}
    else
        sendMail "GOLLF_emt_${APPLICATION_NAME}_Restarted" ${REDEPLOY_LOG}
    fi
   
  else
    sendMail "GOLLF_emt_${APPLICATION_NAME}_${SERVER_NAME}_Restarting" ${REDEPLOY_LOG}
    /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -ServerName ${SERVER_NAME} -Action Stop > ${REDEPLOY_LOG} 2>&1
    /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -ServerName ${SERVER_NAME} -Action Start >> ${REDEPLOY_LOG} 2>&1
   
    ERROR=`tail -10 ${REDEPLOY_LOG} | grep "EMT Failed."`
    echo ${ERROR}
    if [ ! -z ${ERROR} ]; then
        sendMail "GOLLF_emt_${APPLICATION_NAME}_${SERVER_NAME}_Restarted_FAIL" ${REDEPLOY_LOG}
    else
        sendMail "GOLLF_emt_${APPLICATION_NAME}_${SERVER_NAME}_Restarted" ${REDEPLOY_LOG}
    fi
   
  fi

  chmod 777 ${gROOT}/${LOG_FOLDER}/.* &
}

release2Server(){
  set -x

  SERVER_NAME=${1}
  EAR_FILE=${2}.ear
  EAR_PATH=/opt/apps/${SERVER_NAME}/9.2/weblogic/ear_deployments

  echo ----------------- Releasing to ${SERVER_NAME} -----------------

  checkFolder ${gROOT}/${GOLLF_ARCHIVE}

  find ${gROOT}/${GOLLF_ARCHIVE} -mtime +3 -exec rm -rf {} \;

  currdate=`date '+%m%d%H%M%S'`
  mv ${EAR_PATH}/${EAR_FILE} ${gROOT}/${GOLLF_ARCHIVE}/${EAR_FILE}.${currdate}
  cp ${ARCHIVE_PATH}/${EAR_FILE} ${EAR_PATH}/${EAR_FILE}
  chmod 777 ${EAR_PATH}/${EAR_FILE}

}

redeploy2Server(){

  SERVER_NAME=${1}
  EARAppName=${2}
  EAR_NAME=${EARAppName}.ear
  EAR_PATH=/opt/apps/${SERVER_NAME}/9.2/weblogic/ear_deployments

  PROP_FILE=${gROOT}/${LOG_FOLDER}/.deploy.${SERVER_NAME}.properties
  REDEPLOY_LOG=${gROOT}/${LOG_FOLDER}/.redeploy.${SERVER_NAME}.log

  echo "Redeploying ${SERVER_NAME} with emt -- ${EARAppName} " > ${REDEPLOY_LOG}

  echo "EARAppPath=${EAR_PATH}/${EAR_NAME}" > ${PROP_FILE}
  echo "EARAppName=${EARAppName}" >> ${PROP_FILE}
  echo "EARAppTargets=${SERVER_NAME}Cluster" >> ${PROP_FILE}

  cat ${PROP_FILE}
  cat ${PROP_FILE} >> ${REDEPLOY_LOG}

  sendMail "GOLLF_emt_${SERVER_NAME}_Redeploying -- ${EAR_NAME}" ${REDEPLOY_LOG}

  /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${SERVER_NAME} -Action ExecutePyScript -ScriptName undeploy.py -PropertiesLocation ${PROP_FILE} >${REDEPLOY_LOG} 2>&1
  /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${SERVER_NAME} -Action ExecutePyScript -ScriptName EMTS_deployApp.py -PropertiesLocation ${PROP_FILE} >>${REDEPLOY_LOG} 2>&1

  ERROR=`tail -10 ${REDEPLOY_LOG} | grep "EMT Failed."`
  echo ${ERROR}
  if [ ! -z ${ERROR} ]; then
    sendMail "GOLLF_emt_${SERVER_NAME}_Redeployed_FAIL -- ${EAR_NAME}" ${REDEPLOY_LOG}
  else
    sendMail "GOLLF_emt_${SERVER_NAME}_Redeployed -- ${EAR_NAME}" ${REDEPLOY_LOG}
  fi

  chmod 777 ${gROOT}/${LOG_FOLDER}/.* &
}

if [ $CMD = 'update' ]; then
    updateCVS
    exit ${CVS_COUNT}
elif [ $CMD = 'rm' ]; then
    removeFolderQuickly ${2}
elif [ $CMD = 'hermes' ]; then

    if [ $# -lt 3 ]; then
      hermesUsage
      exit
    fi
    if [ $2 != 'integration' -a $2 != 'major' -a $2 != 'minor' -a $2 != 'bugfix' -a $2 != 'resubmission' ]; then
      hermesUsage
      exit
    fi

    shift
    hermes $*
   
elif [ $CMD = 'hermesall' ]; then

    if [ $# -lt 3 ]; then
      hermesUsage
      exit
    fi
    if [ $2 != 'integration' -a $2 != 'major' -a $2 != 'minor' -a $2 != 'bugfix' -a $2 != 'resubmission' ]; then
      hermesUsage
      exit
    fi

    RELEASE_TYPE=$2

    shift
    shift
    until [ $# -eq 0 ] 
    do
      hermes ${RELEASE_TYPE} $1
      shift
    done 

elif [ $CMD = 'updateall' ]; then

    shift
    until [ $# -eq 0 ] 
    do
      updateCVS $1
      shift
    done 

    updateCVS common

elif [ $CMD = 'makeall' ]; then

    shift
    ./$0 updateall $*
   
    until [ $# -eq 0 ] 
    do
      ./$0 make $1 &
      shift
    done 

elif [ $CMD = 'make' ]; then

    if [ $# -lt 2 ]; then
        exit
    fi
   
    cd ${gROOT}
    updateCVS common
    case $2 in
        comps)
          updateCVS comps/backend
          buildGollf comps backend 43884 gCompsSrv.mk
          archiveGollfEar comps backend gCompsSrv.ear
          ;;
        ds)
          updateCVS ds/backend
          buildGollf ds backend 48080 gDSSrv.mk
          archiveGollfEar ds backend DsSrv.ear
          ;;
        scorecard)
          updateCVS scorecard/backend
          buildGollf scorecard backend 57113 gScoreCardSrv.mk
          archiveGollfEar scorecard backend gScoreCardSrv.ear
          ;;
        gemfire)
          updateCVS gemfire/cache
          buildGollf gemfire cache 57984 gGemfSrv.mk
          archiveGollfDstream gemfire cache gGemfSrv.dstream
          ;;
        profile)
          updateCVS profile/backend
          buildGollf profile backend 55503 gProfileSrv.mk
          archiveGollfEar profile backend gProfileSrv.ear
          ;;
        entl)
          updateCVS entl/backend
          buildGollf entl backend 48081 gEntlSrv.mk
          archiveGollfEar entl backend EntlSrv.ear
          ;;
        refdata)
          updateCVS refdata/backend
          buildGollf refdata backend 66802 gRefDataSrv.mk
          archiveGollfEar refdata backend gRefSrv.ear
          ;;
     esac

elif [ $CMD = 'comps' ]; then
    cd ${gROOT}
    ./$0 make $CMD
    echo ----------------- Done -----------------
elif [ $CMD = 'compsx' ]; then

    shift

    ./$0 comps $*
    ./$0 rexelv comps
    echo ----------------- Done -----------------
elif [ $CMD = 'compsdb' ]; then

    updateCVS comps/db

    PKG_NAME=comps
    CTRL_FILE=gCompsDB
    RESULT_FILE=${gROOT}/${PKG_NAME}Compile/${PKG_NAME}/db/comps.db.result.txt
   
    mergeGollfDB ${PKG_NAME}Compile ${PKG_NAME} ${CTRL_FILE} ${RESULT_FILE}
   
    echo ----------------- Done -----------------
elif [ $CMD = 'ds' ]; then
    cd ${gROOT}
    ./$0 make $CMD
    echo ----------------- Done -----------------
elif [ $CMD = 'dsx' ]; then

    shift

    ./$0 ds $*
    ./$0 rexelv ds
    echo ----------------- Done -----------------
elif [ $CMD = 'dsdb' ]; then

    updateCVS ds/db

    PKG_NAME=ds
    CTRL_FILE=gollf
    RESULT_FILE=${gROOT}/${PKG_NAME}Compile/${PKG_NAME}/db/ds.db.result.txt
   
    mergeGollfDB ${PKG_NAME}Compile ${PKG_NAME} ${CTRL_FILE} ${RESULT_FILE}
   
    echo ----------------- Done -----------------
elif [ $CMD = 'scorecard' ]; then
    ./$0 make $CMD
    echo ----------------- Done -----------------
elif [ $CMD = 'gemfire' ]; then
    ./$0 make $CMD
    echo ----------------- Done -----------------
elif [ $CMD = 'profile' ]; then
    ./$0 make $CMD
    echo ----------------- Done -----------------
elif [ $CMD = 'entl' ]; then
    ./$0 make $CMD
    echo ----------------- Done -----------------
elif [ $CMD = 'refdata' ]; then
    ./$0 make $CMD
    echo ----------------- Done -----------------
elif [ $CMD = 'client' ]; then
    updateCVS client
    prepareClient
    unzipClient

    cd ${gROOT}/${GOLLF_CLIENT}/client
    /xenv/xenv -i GollfClient.env . <<EOF
make clean -f GollfClient.mk
make package -f GollfClient.mk
chmod 777 COMPSClientPkg.dstream
EOF

elif [ $CMD = 'cadd' ]; then
  set -x

  echo OWNER - gfidds
#  cd ${gROOT}/${GOLLF_CLIENT}/client
  /export/opt/SCsudo/bin/scsudo root /usr/sbin/pkgadd -d ${gROOT}/${GOLLF_CLIENT}/client/COMPSClientPkg.dstream

elif [ $CMD = 'crm' ]; then
  set -x
  /export/opt/SCsudo/bin/scsudo root /usr/sbin/pkgrm COMPSClientPkg

elif [ $CMD = 'pkgrmComps' ]; then
    set -x
    /export/opt/SCsudo/bin/scsudo root /usr/sbin/pkgrm  gCompsSrv
elif [ $CMD = 'pkgaddComps' ]; then
    set -x
    /export/opt/SCsudo/bin/scsudo root /usr/sbin/pkgadd -R / -d ${COMPS_COMPILE_BACK}/gCompsSrv.dstream

#--------------- WL Server ----------------
elif [ $CMD = 'restart' ]; then

    if [ $# -lt 2 ]; then
        exit
    fi

    case $2 in
        9045)
          APPLICATION_NAME=comps
          ;;
        9055)
          APPLICATION_NAME=gollfdev
          ;;
        9065)
          APPLICATION_NAME=gollf
          ;;
     esac

     case $3 in
        node1)
          SERVER_NAME=${APPLICATION_NAME}Node1
          ;;
        node2)
          SERVER_NAME=${APPLICATION_NAME}Node2
          ;;
     esac

     restartServer ${APPLICATION_NAME} ${SERVER_NAME}

elif [ $CMD = 'start' ]; then

    if [ $# -lt 2 ]; then
        exit
    fi

    case $2 in
        9045)
          APPLICATION_NAME=comps
          ;;
        9055)
          APPLICATION_NAME=gollfdev
          ;;
        9065)
          APPLICATION_NAME=gollf
          ;;
    esac

    case $3 in
        node1)
          SERVER_NAME=${APPLICATION_NAME}Node1
          ;;
        node2)
          SERVER_NAME=${APPLICATION_NAME}Node2
          ;;
     esac

     if [ ${SERVER_NAME} ]; then
       /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -ServerName ${SERVER_NAME} -Action Start
     else
       /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -Action Start
     fi

elif [ $CMD = 'stop' ]; then

    case $2 in
        9045)
          APPLICATION_NAME=comps
          ;;
        9055)
          APPLICATION_NAME=gollfdev
          ;;
        9065)
          APPLICATION_NAME=gollf
          ;;
    esac

    case $3 in
        node1)
          SERVER_NAME=${APPLICATION_NAME}Node1
          ;;
        node2)
          SERVER_NAME=${APPLICATION_NAME}Node2
          ;;
     esac

     if [ ${SERVER_NAME} ]; then
       /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -ServerName ${SERVER_NAME} -Action Stop
     else
       /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${APPLICATION_NAME} -Action Stop
     fi

elif [ $CMD = 'rex' ]; then

    if [ $# -lt 3 ]; then
        exit
    fi

    ./$0 release $2 $3
    ./$0 redeploy $2 $3

elif [ $CMD = 'release' ]; then

    if [ $# -lt 3 ]; then
    exit
    fi

    case $2 in
    9045)
      SERVER_NAME=comps
      ;;
    9055)
          SERVER_NAME=gollfdev
          ;;
        9065)
          SERVER_NAME=gollf
          ;;
        *)
          exit 1
          ;;
     esac

     case $3 in
     comps)
       EAR_FILE=gCompsSrv
       ;;
     ds)
          EAR_FILE=DsSrv
          ;;
        profile)
          EAR_FILE=gProfileSrv
          ;;
        entl)
          EAR_FILE=EntlSrv
          ;;
        scorecard)
          EAR_FILE=gScoreCardSrv
          ;;
        refdata)
          EAR_FILE=gRefSrv
          ;;
        *)
          exit 1
          ;;
     esac

    release2Server ${SERVER_NAME} ${EAR_FILE}

elif [ $CMD = 'redeploy' ]; then

    if [ $# -lt 3 ]; then
        exit
    fi

    case $2 in
        9045)
          SERVER_NAME=comps
          ;;
        9055)
          SERVER_NAME=gollfdev
          ;;
        9065)
          SERVER_NAME=gollf
          ;;
        *)
          exit 1
          ;;
     esac

     case $3 in
        ds)
          EARAppName=DsSrv
          ;;
        comps)
          EARAppName=gCompsSrv
          ;;
        profile)
          EARAppName=gProfileSrv
          ;;
        entl)
          EARAppName=EntlSrv
          ;;
        scorecard)
          EARAppName=gScoreCardSrv
          ;;
        refdata)
          EARAppName=gRefSrv
          ;;
        *)
          exit 1
          ;;
     esac

    redeploy2Server ${SERVER_NAME} ${EARAppName}

elif [ $CMD = 'py' ]; then

    if [ $# -lt 3 ]; then
        exit
    fi

    case $2 in
        9045)
          SERVER_NAME=comps
          ;;
        9055)
          SERVER_NAME=gollfdev
          ;;
        9065)
          SERVER_NAME=gollf
          ;;
        *)
          exit 1
          ;;
     esac

set -x

  cp /home/sh13256/${3} /opt/apps/${SERVER_NAME}/9.2/weblogic/src/scripts/

  /export/opt/emt/1.0/wls/bin/emt -ApplicationName ${SERVER_NAME} -Action ExecutePyScript -ScriptName ${3}

elif [ $CMD = 'pkgadd' ]; then

    if [ $# -lt 2 ]; then
        exit
    fi

    case $2 in
        ds)
          DSTREAM_NAME=gDSSrv
          ;;
        comps)
          DSTREAM_NAME=gCompsSrv
          ;;
        profile)
          DSTREAM_NAME=gProfSrv
          ;;
        entl)
          DSTREAM_NAME=gEntlSrv
          ;;
        gemfire)
          DSTREAM_NAME=gGemfSrv
          ;;
        *)
          exit 1
          ;;
     esac

  /export/opt/SCsudo/bin/scsudo root /usr/sbin/pkgadd -R / -d ${2}Compile/${2}/*/${DSTREAM_NAME}.dstream


#----------- Comps ----------------
elif [ $CMD = 'restartComps' ]; then
  set -x
#  /export/opt/emt/1.0/wls/bin/emt -ApplicationName comps -Action Stop
#  /export/opt/emt/1.0/wls/bin/emt -ApplicationName comps -Action Start

  /export/opt/emt/1.0/wls/bin/emt -ApplicationName comps -Action Stop  -ServerName compsNode1
  /export/opt/emt/1.0/wls/bin/emt -ApplicationName comps -Action Start -ServerName compsNode1

#------------ Elv Domain -----------------
elif [ $CMD = 'elvdomain' ]; then

set -x

  rm -R ${ELV_DOMAIN}

WL_92_MP2=/export/opt/bea/9.2_MP2
WL_92_MP1=/export/opt/bea/9.2_MP1

#dev3d
WL_92=${WL_92_MP1}
WLST=/home/sh13256/GollfWork/cmd/wlst_92MP1.sh

#if [ -d ${WL_92_MP2} ]; then
#   WL_92=${WL_92_MP2}
#dev2d
#   WLST=${WL_92}/weblogic92/common/bin/wlst.sh
#fi

  ${WLST} /home/sh13256/elvCompsDomainLdrap1d.py
  cp /home/sh13256/GollfWork/cmd/startWebLogic.sh ${ELV_DOMAIN}/bin/startWebLogic.sh
  cp /home/sh13256/GollfWork/cmd/startManagedWebLogic_3d.sh ${ELV_DOMAIN}/bin/startManagedWebLogic.sh
  cp /home/sh13256/GollfWork/cmd/stopWebLogic.sh ${ELV_DOMAIN}/bin/stopWebLogic.sh

elif [ $CMD = 'elvdomainZ' ]; then

  set -x

  rm -R ${ELV_DOMAIN}
  mkdir ${ELV_DOMAIN}
  cp /home/sh13256/GollfWork/elvDomain.tar.Z ${ELV_DOMAIN}
  uncompress ${ELV_DOMAIN}/elvDomain.tar.Z
  cd ${ELV_DOMAIN}
  tar xvf ${ELV_DOMAIN}/elvDomain.tar
  rm ${ELV_DOMAIN}/elvDomain.tar

elif [ $CMD = 'releaseelvA' ]; then
  set -x

  FILE_NAME=echo $2 | sed 's/\.[0-9]*$//'

  cp ${ARCHIVE_PATH}/$2 ${gROOT}/applications/${FILE_NAME}

elif [ $CMD = 'rexelv' ]; then

  set -x

    if [ $# -lt 2 ]; then
        exit
    fi

    case $2 in
        ds)
          EARAppName=DsSrv
          EAR_FILE=DsSrv.ear
          ;;
        comps)
          EARAppName=gCompsSrv
          EAR_FILE=gCompsSrv.ear
          ;;
        profile)
          EARAppName=gProfileSrv
          EAR_FILE=gProfileSrv.ear
          ;;
        entl)
          EARAppName=EntlSrv
          EAR_FILE=EntlSrv.ear
          ;;
        scorecard)
          EARAppName=gScoreCardSrv
          EAR_FILE=gScoreCardSrv.ear
          ;;
        refdata)
          EARAppName=gRefSrv
          EAR_FILE=gRefSrv.ear
          ;;
        *)
          exit 1
          ;;
     esac

  ELV_ARCHIVE=archiveElv

  checkFolder ${gROOT}/${ELV_ARCHIVE}

  cp ${ARCHIVE_PATH}/${EAR_FILE} ${gROOT}/${ELV_ARCHIVE}/${EAR_FILE}
  chmod 777 ${gROOT}/${ELV_ARCHIVE}/${EAR_FILE}

  #################################################

  REDEPLOY_LOG=${gROOT}/${LOG_FOLDER}/.redeploy.elv.${EARAppName}

  HOST_NAME=`hostname`

  WL_CP=${WL_92}/weblogic92/server/lib/weblogic.jar

  JAVA=${WL_92_MP1}/jdk150_06/bin/java

  if [ -d ${WL_92_MP2} ]; then
    JAVA=${WL_92_MP2}/jdk150_10/bin/java
  fi

  ADMIN_URL=t3://${HOST_NAME}.nam.nsroot.net:12001
  USER_NAME=weblogic
  PASS_WORD=weblogic
  SOURCE=${gROOT}/${ELV_ARCHIVE}/${EAR_FILE}
  TARGET=devServer
  NAME=${EARAppName}

  echo ADMIN_URL=${ADMIN_URL} > ${REDEPLOY_LOG}
  echo SOURCE=${SOURCE} >> ${REDEPLOY_LOG}
  echo TARGET=${TARGET} >> ${REDEPLOY_LOG}
  echo NAME=${NAME} >> ${REDEPLOY_LOG}

  sendMail "GOLLF_elvDomain_Redeploying -- ${EARAppName}" ${REDEPLOY_LOG}

  . ${WL_92}/weblogic92/common/bin/commEnv.sh > ${REDEPLOY_LOG} 2>&1
  ${JAVA} -cp ${WL_CP} weblogic.Deployer -adminurl ${ADMIN_URL} -user ${USER_NAME} -password ${PASS_WORD} -name ${NAME} -undeploy >> ${REDEPLOY_LOG} 2>&1
  ${JAVA} -cp ${WL_CP} weblogic.Deployer -adminurl ${ADMIN_URL} -user ${USER_NAME} -password ${PASS_WORD} -source ${SOURCE} -targets ${TARGET} -name ${NAME} -deploy >> ${REDEPLOY_LOG} 2>&1

  sendMail "GOLLF_elvDomain_Redeployed -- ${EARAppName}" ${REDEPLOY_LOG}

  chmod 777 ${gROOT}/${LOG_FOLDER}/.* &

elif [ $CMD = 'stopelv' ]; then
set -x

  HOST_NAME=`hostname`

  cd ${ELV_DOMAIN}/bin
  stopManagedWebLogic.sh devServer t3://${HOST_NAME}.nam.nsroot.net:12001 weblogic weblogic
  stopWebLogic.sh

elif [ $CMD = 'startelv' ]; then

  SLEEP=`expr 60 \* 1`

  HOST_NAME=`hostname`
 
  cd ${ELV_DOMAIN}/bin
  startWebLogic.sh &

  echo ------ sleeping ${SLEEP} seconds.
  sleep ${SLEEP}
  echo ------ starting managed server.
  startManagedWebLogic.sh devServer http://${HOST_NAME}.nam.nsroot.net:12001 &

elif [ $CMD = 'elv' ]; then
set -x
  ./$0 stopelv
  sleep 10
  ./$0 elvdomain
  ./$0 startelv

elif [ $CMD = 'createdomain' ]; then
  set -x

    if [ $# -lt 2 ]; then
        exit
    fi
    case $2 in
        9045)
          SERVER_NAME=comps
          AdminServerPort=9040
          MSPortNumbers=9044:9046
          ;;
        9055)
          SERVER_NAME=gollfdev
          AdminServerPort=9050
          MSPortNumbers=9054:9056
          ;;
        9065)
          SERVER_NAME=gollf
          AdminServerPort=9060
          MSPortNumbers=9064:9066
          ;;
        *)
          exit 1
          ;;
     esac

#    /export/opt/emt/2.0/wls/bin/emt -ApplicationName ${SERVER_NAME} -Action Remove
#    /export/opt/emt/2.0/wls/bin/emt -ApplicationName ${SERVER_NAME} -Action Clean -Confirm yes

    TEMP_FILE=/tmp/${SERVER_NAME}.properties

    echoToFile ${TEMP_FILE} ApplicationName=gollfdev
    echoToFile ${TEMP_FILE} ApplicationId=153263
    echoToFile ${TEMP_FILE} AdminServerPort=${AdminServerPort}
    echoToFile ${TEMP_FILE} Nodes=2
    echoToFile ${TEMP_FILE} MSDNSNames=ldrap1d.nam.nsroot.net:ldrap1d.nam.nsroot.net
    echoToFile ${TEMP_FILE} MSPortNumbers=${MSPortNumbers}
    echoToFile ${TEMP_FILE} CreateCluster=y
    echoToFile ${TEMP_FILE} ASDNSName=ldrap1d.nam.nsroot.net
    echoToFile ${TEMP_FILE} CreateDefaultUser=true
    echoToFile ${TEMP_FILE} DeployWLMON=true
    echoToFile ${TEMP_FILE} Action=CreateDomain
    echoToFile ${TEMP_FILE} Operationsid=gollf
    echoToFile ${TEMP_FILE} Groupid=ficmgrp
    echoToFile ${TEMP_FILE} AppFunctionalId=gollf
    echoToFile ${TEMP_FILE} DefaultStart=Y
    echoToFile ${TEMP_FILE} DefaultStartServers=Y:N
    echoToFile ${TEMP_FILE} ServerStartTimeout=300
    echoToFile ${TEMP_FILE} IdentityKeyStorePassPhrase=store@ldrap1d
    echoToFile ${TEMP_FILE} TrustKeyStorePassPhrase=capassword
    echoToFile ${TEMP_FILE} IdentityKeyPassPhrase=key@ldrap1d
    echoToFile ${TEMP_FILE} IdentityAlias=gollfidentity
    echoToFile ${TEMP_FILE} IdentityKeyStoreType=jceks
    echoToFile ${TEMP_FILE} EnvironmentType=dev
    echoToFile ${TEMP_FILE} JavaHome=/export/opt/bea/9.2_MP1/jdk150_06
    echoToFile ${TEMP_FILE} WebLogicHome=/export/opt/bea/9.2_MP1/weblogic92
    echoToFile ${TEMP_FILE} Verbose=true
   
    cat ${TEMP_FILE}

    /export/opt/emt/2.0/wls/bin/emt ${TEMP_FILE}

elif [ $CMD = 'ps' ]; then

  /usr/ucb/ps -auxwww

elif [ $CMD = 'log' ]; then

set -x

    if [ $# -lt 3 ]; then
        exit
    fi

    case $2 in
        9045)
          SERVER_NAME=compsDomain
          ;;
        9055)
          SERVER_NAME=gollfdevDomain
          ;;
     esac

     case $3 in
        comps)
          EARAppName=gCompsSrv
#          echo tail -f /opt/apps/weblogic/9.2/user_projects/${SERVER_NAME}/gCompsSrvLogs/${EARAppName}.log &
          ;;
        ds)
          EARAppName=DsSrv
#          echo tail -f /opt/apps/weblogic/9.2/user_projects/${SERVER_NAME}/DsSrvLogs/${EARAppName}.log &
          ;;
     esac

     tail -f /opt/apps/weblogic/9.2/user_projects/${SERVER_NAME}/${EARAppName}Logs/${EARAppName}.log &

elif [ $CMD = 'echolog' ]; then

  echo 'tail -f /home/sh13256/GollfWork/elvDomainProp/Logs/DsSrv.log &'
  echo
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsDomain/DsSrvLogs/DsSrv_Node1.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsDomain/DsSrvLogs/DsSrv_Node2.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsDomain/gCompsSrvLogs/gCompsSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsDomain/EntlSrvLogs/EntlSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsDomain/gProfileSrvLogs/gProfileSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsDomain/gScoreCardSrvLogs/gScoreCardSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsDomain/gRefSrvLogs/refDataSrv.log &'
  echo
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/DsSrvLogs/DsSrv_Node1.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/DsSrvLogs/DsSrv_Node2.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/gCompsSrvLogs/gCompsSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/EntlSrvLogs/EntlSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/gProfileSrvLogs/gProfileSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/gScoreCardSrvLogs/gScoreCardSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/gRefSrvLogs/refDataSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/gollfdevDomain/refDataSrvLogs/refDataSrv.log &'
  echo
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsdevDomain/DsSrvLogs/DsSrv_Node1.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsdevDomain/DsSrvLogs/DsSrv_Node2.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsdevDomain/gCompsSrvLogs/gCompsSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsdevDomain/EntlSrvLogs/EntlSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsdevDomain/gProfileSrvLogs/gProfileSrv.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/compsdevDomain/gScoreCardSrvLogs/gScoreCardSrv.log &'
  echo
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/elvDomain/servers/compsServer/logs/compsServer.log &'
  echo 'tail -f /opt/apps/weblogic/9.2/user_projects/elvDomain/servers/compsServer/logs/base_domain.log &'

elif [ $CMD = 'wsdl' ]; then

  echo 'https://ldrap1d.nam.nsroot.net:9045/gRefSrv/services/RefDataCentralService?wsdl'

fi

分享到:
评论

相关推荐

    spring boot/spring cloud项目启动脚本,默认名称:start.sh

    linux服务器,springboot,spring cloud、spring ...sh start.sh start sh start.sh stop sh start.sh restart sh start.sh status 或者: ./start.sh start ./start.sh stop ./start.sh restart ./start.sh status

    魅蓝note3 global.sh beta.sh

    命令输入工具(终端模拟器,可在自带的应用商店中搜索下载 一个551k大小的安装包),公开版官方包(官网中下载),脚本文件global.sh 手机必须彻底root(自带root开启后下载Kingroot获取完整权限 这个root不用担心...

    ubuntu如何运行.sh文件,.sh文件运行提示脚本异常

    ubuntu执行.sh文件,1 .sh文件是Ubuntu下可执行文件,首先需要确定它的权限是否是可执行的,2、 用vim打开sh文件,3、查看文件格式:4. 修改文件格式: 5. 保存退出: 6. 执行:./filename 注意:不可以用sh ...

    iterm2-send-zmodem.sh and iterm2-recv-zmodem.sh

    本文将详细讲解如何利用`iTerm2`配合`ZModem`协议的脚本`iterm2-send-zmodem.sh`和`iterm2-recv-zmodem.sh`来解决在远程服务器上进行文件传输时遇到的问题。 首先,让我们了解`ZModem`协议。`ZModem`是一种双向、...

    getinfo.sh

    chmod +x getinfo.sh ./getinfo.sh 注:此脚本可以以一般用户收集到信息(除fdisk只能以root运行) 1. 基本信息 - 适合所有linux问题 - getinfo.sh basic 2.硬盘/文件系统问题(基本,全盘信息) -需要用户成为root并...

    acme.sh 实现了 acme 协议,可以从 Let's Encrypt 生成免费的证书,内含完整源代码

    acme.sh 实现了 acme 协议,可以从 Let's Encrypt 生成免费的证书,内含完整源代码 生成证书 acme.sh 实现了 acme 协议支持的所有验证协议,有两种方式验证: http 验证 和 dns 验证。 1. http 方式 http 方式需要...

    Ubuntu下运行.sh文件

    在Ubuntu操作系统中,`.sh` 文件通常是一种shell脚本,用于执行一系列的命令或自动化任务。这类文件在Linux和类Unix系统中广泛使用。要成功地在Ubuntu上运行`.sh` 文件,你需要遵循一系列步骤,确保文件具有正确的...

    startup.sh linux 启动jar包命令

    startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令

    关于Root.sh

    Oracle数据库在Linux环境下安装完成后,需要运行root.sh脚本来完成安装过程的最后一步,这个脚本主要负责执行一些需要root权限的操作,确保Oracle数据库的环境设置和权限配置正确无误。本文将详细介绍root.sh脚本的...

    tinyos.sh文件

    tinyos.sh文件,在linux环境下生成,cygwin环境下可用,tinyos.sh文件总出问题的可以下载,将绝对路径修改成自己的

    Solaris pstack.sh

    The following scripts are located in obisolaris.tar.gz (2013-07-12) obimon (0.1) - monitor memory and connection...unpackDbx.sh.sh (0.2) - extracts dbx from Studio 12.3 download. See instructions below.

    get-docker.sh docker安装脚本

    get-docker.sh docker安装脚本,可直接执行 sh get-docker.sh --mirror Aliyun 安装

    iOS重签名 Resign.sh

    将Resign.sh与你的mobileprovision文件和ipa文件放在同一个文件夹内。 ### 2.打开命令行,复制 chmod +x ,再敲一个空格,再将Resign.sh拖入命令行里面,回车。 ### 3.继续将Resign.sh拖入命令行内,回车,将会出现...

    startServer.sh

    startServer.sh

    qnap-acme.sh

    威联通QNAP自动续签更新SSL证书脚本(配合acme.sh使用),支持Let's Encrypt免费证书,支持域名泛解析证书,如:*.xx.com。

    linux通用版本jar启动脚本傻瓜式启动 run.sh

    linux通用版本jar启动脚本傻瓜式启动 sh run.sh start 启动 sh run.sh stop 停止 nohup java -jar XXX.jar & nohup 意思是不挂断运行命令,当账户退出或终端关闭时,程序仍然运行

    wait-for-it.sh脚本

    wait-for-it.sh是一个Shell脚本,主要用于在Docker容器启动时等待某个服务(如数据库、消息队列等)变得可用。在某些分布式系统中,各个服务的启动顺序和依赖关系很重要,wait-for-it.sh可以帮助解决这个问题。

    jdk_install.sh

    liunx 一键安装jdk脚本,实现jdk 一键安装 (bash jdk_install.sh)

    ldd.sh app.sh

    "ldd.sh" 和 "app.sh" 是两个在Linux环境中常见的脚本文件,它们在Qt程序打包发布过程中扮演着重要角色。现在让我们深入探讨这两个脚本文件的功能以及它们如何与“导出库”这个概念关联。 首先,`ldd.sh` 是一个...

    ssdtPRGen.sh, 为电源管理生成SSDT的脚本.zip

    ssdtPRGen.sh, 为电源管理生成SSDT的脚本 ssdtPRGen.sh你可以在终端窗口中输入以下命令来下载最新的ssdtPRGen.sh 测试版:curl -o ~/ssdtPRGen.sh https://raw.githubusercontent.com/Piker

Global site tag (gtag.js) - Google Analytics