#!/bin/sh

#IBM Confidential OCO Source Material
#5630-A36 (C) COPYRIGHT International Business Machines Corp. 2006
#The source code for this program is not published or otherwise divested
#of its trade secrets, irrespective of what has been deposited with the
#U.S. Copyright Office.

#initialize variables
INSTALLSRC=`pwd`
IMAGESDIR=""; export IMAGESDIR
TWS_TOOLS_DIR=$INSTALLSRC/tws_tools
ERROR="0"; export ERROR
INSTALLROOT=""; export INSTALLROOT
TWSUSER=""; export TWSUSER
TWSPASSWORD=""; export TWSPASSWORD
CONNECTION=""; export CONNECTION
ENGINE=""; export ENGINE
ZOSHOST=""; export ZOSHOST
ZOSPORT=""; export ZOSPORT
HOST=""; export HOST
LDAPPORT=""; export LDAPPORT
FQDN=""; export FQDN
HTTPPORT=""; export HTTPPORT
HTTPSPORT=""; export HTTPSPORT
BTSTRPORT=""; export BTSTRPORT
SOAPPORT=""; export SOAPPORT
ADMINPORT=""; export ADMINPORT
ADMINSECPORT=""; export ADMINSECPORT

# The range for return codes for this script is: [60 - 99].
# The reason is explained below for each return code.
# 0   - successful
# 60  - bad usage
# 61  - invalid command line parameters
# 62  - TWS install location doesn't exist
# 63  - appserver install location doesn't exist
# 64  - error creating profile
# 65  - error importing profile
# 66  - error changing configuration of the appserver
# 67  - error starting the appserver
# 68  - error configuring the realm
# 69  - error stopping the appserver

#This method is used for abnormal termination. The following parameters must be passed
#   reason      -   failure explanation
#   exit code
exitOnError()
{
	exitCode=$1
	shift
	reason=$*
    echo "ERROR: The script ended abnormally. The reason is: $reason"
    if [ -d "$PROFILEPATH" ]; then
        echo "Rollback of the profile $PROFILENAME ..."
        $INSTALLROOT/bin/wasprofile.sh -delete -profileName $PROFILENAME
        if [ $? -ne 0 ]; then
            ERROR="$?"
            reason="Possible error, $ERROR, during rollback of the profile $PROFILENAME."
        fi
        mv $PROFILEPATH $PROFILEPATH.deleted
    fi
	echo "The script exit code is $exitCode"
	exit $exitCode
}

#This method is used when the usage option is used. The following parameter must be passed
#   exit code
exitOnUsage()
{
	exitCode=$1
	echo "The script exit code is $exitCode"
	exit $exitCode
}

#MAIN

#Parsing Parameters

if [ $# -eq 0 ]
then
  echo " The usage of the installConnector is :"
  echo " installZConnector -imagesDir [imagesDir] -installRoot [installRoot] -twsUser [twsUser] -twsPassword [twsPassword] -engine [engine] -zosHost [zosHost] -zosPort [zosPort]  -host [host] -LDAPPort [port] -HTTPPort [HTTPPort] -HTTPSPort [HTTPSPort] -BootStrapPort [BootStrapPort] -SOAPPort [SOAPPort] -AdminPort [AdminPort] -AdminSecPort [AdminSecPort]"
  echo " Example: installZConnector -imagesDir /opt/TWSZCONNImages -twsRoot /opt/TWS -installRoot /opt/TWS/appserver -twsUser twsAdmin -twsPassword AdminTWS -engine zosengine -zosHost zoshost -zosPort 12345 -host LDAPSRV -LDAPPort 1055 -HTTPPort 31115 -HTTPSPort 31116 -BootStrapPort 31117 -SOAPPort 31118 -AdminPort 31119 -AdminSecPort 31120"
  echo " imagesDir - where the TWSZCONN images are located"
  echo " twsRoot - where the TWS installation is located"
  echo " installRoot - where the application server is installed"
  echo " twsUser - owner of the TWSZCONN instance"
  echo " twsPassword - This is the password of the above user"
  echo " connection - This is the name of the connection factory, use NONE if no connection must be configured"
  echo " engine - This is the name of the engine"
  echo " zosHost - This is the hostname of the zOS host"
  echo " zosPort - This is the port of the zOS host"
  echo " host - this is the host ID of the LDAP server (it's assumed that the LDAP is installed on the same machine than the application server)"
  echo " LDAPPort - this is the port of the LDAP server"
  echo " FQDNHost - this is the fully qualified domain name of the target host"
  echo " HTTPPort - This is the HTTP transport port of the application server"
  echo " HTTPSPort - This is the HTTPS transport port of the application server"
  echo " BootStrapPort - this is the bootstrap port of the application server"
  echo " SOAPPort - This is the SOAP connector port of the application server"
  echo " AdminPort - This is the Admin port of the application server"
  echo " AdminSecPort - This is the Admin secure port of the application server"
  ERROR="60"
  reason="bad usage."
  exitOnError $ERROR $reason
fi
                
while [ $# -gt 0 ]
do
  CPARM=$1; export CPARM
  shift

  case $CPARM in
    
    -imagesDir)
      if [ -z "$IMAGESDIR" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the imagesDir parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter imagesDir."
          exitOnError $ERROR $reason
        else 
        IMAGESDIR=$1; export IMAGESDIR
        shift
        fi
      else
       ERROR="61"
       reason="command option -imagesDir supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -installRoot)
      if [ -z "$INSTALLROOT" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the installRoot parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter installRoot."
          exitOnError $ERROR $reason
        else
        INSTALLROOT=$1; export INSTALLROOT
        shift
        fi
      else
       ERROR="61"
       reason="command option -installRoot supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -twsUser)
      if [ -z "$TWSUSER" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the twsUser parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter twsUser."
          exitOnError $ERROR $reason
        else
        TWSUSER=$1; export TWSUSER
        shift
        fi
      else
       ERROR="61"
       reason="command option -twsUser supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -twsPassword)
      if [ -z "$TWSPASSWORD" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the twsPassword parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter twsPassword."
          exitOnError $ERROR $reason
        else
        TWSPASSWORD=$1; export TWSPASSWORD
        shift
        fi
      else
       ERROR="61"
       reason="command option -twsPassword supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -connection)
      if [ -z "$CONNECTION" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the connection parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter connection."
          exitOnError $ERROR $reason
        else
        CONNECTION=$1; export CONNECTION
        shift
        fi
      else
       ERROR="61"
       reason="command option -connection supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -engine)
      if [ -z "$ENGINE" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the engine parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter engine."
          exitOnError $ERROR $reason
        else
        ENGINE=$1; export ENGINE
        shift
        fi
      else
       ERROR="61"
       reason="command option -engine supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -zosHost)
      if [ -z "$ZOSHOST" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the zosHost parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter zosHost."
          exitOnError $ERROR $reason
        else
        ZOSHOST=$1; export ZOSHOST
        shift
        fi
      else
       ERROR="61"
       reason="command option -zosHost supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -zosPort)
      if [ -z "$ZOSPORT" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the zosPort parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter zosPort."
          exitOnError $ERROR $reason
        else
        ZOSPORT=$1; export ZOSPORT
        shift
        fi
      else
       ERROR="61"
       reason="command option -zosPort supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -host)
      if [ -z "$HOST" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the host parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter host."
          exitOnError $ERROR $reason
        else 
        HOST=$1; export HOST
        shift
        fi
      else
       ERROR="61"
       reason="command option -host supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;
  
    -LDAPPort)
      if [ -z "$LDAPPORT" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the LDAPPort parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter LDAPPort."
          exitOnError $ERROR $reason
        else 
        LDAPPORT=$1; export LDAPPORT
        shift
        fi
      else
       ERROR="61"
       reason="command option -LDAPPort supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;
   
    -FQDNHost)
      if [ -z "$FQDN" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the FQDNHost parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter FQDNHost."
          exitOnError $ERROR $reason
        else 
        FQDN=$1; export FQDN
        shift
        fi
      else
       ERROR="61"
       reason="command option -FQDNHost supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -HTTPPort)
      if [ -z "$HTTPPORT" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the HTTPPort parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter HTTPPort."
          exitOnError $ERROR $reason
        else 
        HTTPPORT=$1; export HTTPPORT
        shift
        fi
      else
       ERROR="61"
       reason="command option -HTTPPort supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -HTTPSPort)
      if [ -z "$HTTPSPORT" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the HTTPSPort parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter HTTPSPort."
          exitOnError $ERROR $reason
        else 
        HTTPSPORT=$1; export HTTPSPORT
        shift
        fi
      else
       ERROR="61"
       reason="command option -HTTPSPort supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -BootStrapPort)
      if [ -z "$BTSTRPORT" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the BootStrapPort parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter BootStrapPort."
          exitOnError $ERROR $reason
        else 
        BTSTRPORT=$1; export BTSTRPORT
        shift
        fi
      else
       ERROR="61"
       reason="command option -BootStrapPort supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -SOAPPort)
      if [ -z "$SOAPPORT" ]
       then
        if [ $# -eq 0 ] || [ "`echo $1 | cut -c1`" = "-" ]
        then
          echo " An incorrect value has been supplied for the SOAPPort parameter"
          echo " Use the -usage option to see the available command line options"
          ERROR="61"
          reason="incorrect value for parameter SOAPPort."
          exitOnError $ERROR $reason
        else 
        SOAPPORT=$1; export SOAPPORT
        shift
        fi
      else
       echo " The following parameter -SOAPPort has been supplied more than once "
       ERROR="61"
       reason="command option -SOAPPort supplied more than once."
       exitOnError $ERROR $reason
      fi
    ;;

    -usage)
      echo " The usage of the installConnector is :" 
      echo " installZConnector.sh -twsRoot [twsRoot] -installRoot [installRoot] -twsUser [twsUser] -twsPassword [twsPassword] -connection [connectionfactory] -engine [engine] -zosHost [zosHost] -zosPort [zosPort] -host [host] -LDAPPort [port] -FQDNHost [FQDNHost] -HTTPPort [HTTPPort] -HTTPSPort [HTTPSPort] -BootStrapPort [BootStrapPort] -SOAPPort [SOAPPort]"
      echo " Example: installZConnector -twsRoot /opt/TWS -installRoot /opt/TWS/appserver -twsUser twsAdmin -twsPassword AdminTWS -connection cf1 -engine zosengine -zosHost zoshost -zosPort 12345 -host LDAPSRV -LDAPPort 1055 -FQDNHost myhost.mydomain.com -HTTPPort 31115 -HTTPSPort 31116 -BootStrapPort 31117 -SOAPPort 31118"
      ERROR="0"
      reason="The usage option was used in order to show the script usage."
      exitOnUsage $ERROR
    ;;

    *)
      echo " The command line is invalid"
      echo " Use the -usage option to see the available command line options"
      ERROR="61"
      reason="invalid command line."
      exitOnError $ERROR $reason
    ;;

  esac

done



# check the INSTALLROOT dir

     if [ ! -d "$INSTALLROOT" ]
       then
         echo " The application server install location, $INSTALLROOT, does not exist"
         echo " Please specify the proper location of the application server"
         ERROR="63"
         reason="unexisting path."
         exitOnError $ERROR $reason
     fi

# Set the Env Variables

   APPNAME="TWSEnginePlan"
   PROFILENAME="twszconnprofile"
   PROFILEPATH="$INSTALLROOT/profiles/$PROFILENAME"
   TEMPLATEPATH="$INSTALLROOT/profileTemplates/default"
   NODENAME="DefaultNode"
   HOSTNAME="localhost"
   CELLNAME="DefaultNode"
   SERVERNAME="server1"
   PROFILEARCHIVENAME="twszconnprofile.car"
   DEF_LDAPPORT="389"

   if [ -z "$LDAPPORT" ]
    then
    LDAPPORT="$DEF_LDAPPORT"; export LDAPPORT
   fi

   OS=`uname -s`;export OS

   case $OS in
      AIX)
       INST_INTERP="aix4-r1"; export INST_INTERP
      ;;
      HP-UX)
       case `uname -m` in
         ia64)
          INST_INTERP="hpux11-23-ia64"; export INST_INTERP
         ;;
         *)
          INST_INTERP="hpux10"; export INST_INTERP
         ;;
       esac
      ;;
      Linux)
       case `uname -m` in
         *86*)
          INST_INTERP="linux-ix86"; export INST_INTERP
         ;;
         *390*)
          INST_INTERP="linux-s390"; export INST_INTERP
         ;;
       esac
      ;;
      SunOS)
       INST_INTERP="solaris2"; export INST_INTERP
      ;;
   esac


# createProfile
      echo NODENAME=$NODENAME
      echo PROFILEPATH=$PROFILEPATH
      echo TEMPLATEPATH=$TEMPLATEPATH
      if [ ! -d "$PROFILEPATH" ]
       then
         echo " Creating an empty profile named "$PROFILENAME" "
         echo "$INSTALLROOT/bin/wasprofile.sh -create -profileName $PROFILENAME -profilePath $PROFILEPATH -templatePath $TEMPLATEPATH -nodeName $NODENAME -hostName $HOSTNAME -cellName $CELLNAME -isDefault -serverName $SERVERNAME "
         $INSTALLROOT/bin/wasprofile.sh -create -profileName $PROFILENAME -profilePath $PROFILEPATH -templatePath $TEMPLATEPATH -nodeName $NODENAME -hostName $HOSTNAME -cellName $CELLNAME -isDefault -serverName $SERVERNAME
         if [ $? -ne 0 ]
          then
          ERROR="64"
          reason="possible error, $ERROR, creating profile $PROFILENAME, check system stderr/stdout."
          exitOnError $ERROR $reason
         fi
      fi

# importProfile

      echo " Importing the contents for the Connector in the profile "$PROFILENAME"...."
      echo $PROFILEPATH/bin/wsadmin.sh -conntype NONE -c \"\$AdminTask importWasprofile {-archive $TWS_TOOLS_DIR/$PROFILEARCHIVENAME}\"
      $PROFILEPATH/bin/wsadmin.sh -conntype NONE -c "\$AdminTask importWasprofile {-archive $TWS_TOOLS_DIR/$PROFILEARCHIVENAME}"
      if [ $? -ne 0 ]
        then
          ERROR="65"
          reason="possible error, $ERROR, importing profile archive $PROFILEARCHIVENAME, check system stderr/stdout."
          exitOnError $ERROR $reason
      fi


# change BobcatConfiguration


      echo " Updating configuration of the application server ...."
      echo " $PROFILEPATH/bin/wsadmin.sh -conntype NONE -f $TWS_TOOLS_DIR/postTWSzConnInstallationChanges.jacl $NODENAME $INSTALLROOT $TWSUSER $TWSPASSWORD $CONNECTION $ENGINE $ZOSHOST $ZOSPORT $HOST $LDAPPORT $FQDN $HTTPPORT $HTTPSPORT $BTSTRPORT $SOAPPORT $ADMINPORT $ADMINSECPORT $TWS_TOOLS_DIR/ZOSResourceAdapter.rar"
      $PROFILEPATH/bin/wsadmin.sh -conntype NONE -f $TWS_TOOLS_DIR/postTWSzConnInstallationChanges.jacl $NODENAME $INSTALLROOT $TWSUSER $TWSPASSWORD $CONNECTION $ENGINE $ZOSHOST $ZOSPORT $HOST $LDAPPORT $FQDN $HTTPPORT $HTTPSPORT $BTSTRPORT $SOAPPORT $ADMINPORT $ADMINSECPORT $TWS_TOOLS_DIR/ZOSResourceAdapter.rar
      if [ $? -ne 0 ]
       then
          ERROR="66"
          reason="possible error, $ERROR, updating configuration of the application server, check system stderr/stdout."
          exitOnError $ERROR $reason
      fi

echo
echo " Modifying the environment of the application server profile for TWS ...."
OS=`uname`
cp $PROFILEPATH/bin/setupCmdLine.sh $PROFILEPATH/bin/setupCmdLine.sh.orig

#def. 37352
#if [ "$OS" = "Linux" ]; then
#    echo "LD_ASSUME_KERNEL=2.4.1" >> $PROFILEPATH/bin/setupCmdLine.sh
#    echo "export LD_ASSUME_KERNEL" >> $PROFILEPATH/bin/setupCmdLine.sh
#fi

chmod 755 $PROFILEPATH/bin/setupCmdLine.sh

if [ ! "$ERROR" = "0" ]; then
    exit $ERROR
fi

# update the wsadmin.properties
      echo "Changing com.ibm.ws.scripting.port in wsadmin.properties to $SOAPPORT"
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -delRow "$PROFILEPATH/properties/wsadmin.properties" "# The port property determines what port is used when attempting"
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -delRow "$PROFILEPATH/properties/wsadmin.properties" "# a connection."
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -delRow "$PROFILEPATH/properties/wsadmin.properties" "# The default SOAP port for a single-server installation is 8880"
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -delRow "$PROFILEPATH/properties/wsadmin.properties" com.ibm.ws.scripting.port
      if [ $? -ne 0 ]
        then
           echo "possible error modiying the $PROFILEPATH/properties/wsadmin.properties"
      fi
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -addRow "$PROFILEPATH/properties/wsadmin.properties" "#-------------------------------------------------------------------------"
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -addRow "$PROFILEPATH/properties/wsadmin.properties" "# The port property determines what port is used when attempting"
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -addRow "$PROFILEPATH/properties/wsadmin.properties" "# a connection."
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -addRow "$PROFILEPATH/properties/wsadmin.properties" "# The default SOAP port for a single-server installation is 8880"
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -addRow "$PROFILEPATH/properties/wsadmin.properties" "#-------------------------------------------------------------------------"
      "$IMAGESDIR/ACTIONTOOLS/TWSupdate_file" -addRow "$PROFILEPATH/properties/wsadmin.properties" com.ibm.ws.scripting.port=$SOAPPORT
      if [ $? -ne 0 ]
        then
           echo "possible error modiying the $PROFILEPATH/properties/wsadmin.properties"
      fi



# startServer

      echo " Starting the server "$SERVERNAME"...."
      echo "$PROFILEPATH/bin/startServer.sh $SERVERNAME"
      $PROFILEPATH/bin/startServer.sh $SERVERNAME
      if [ $? -ne 0 ]
       then
          ERROR="67"
          reason="possible error, $ERROR, starting the server $SERVERNAME, check system stderr/stdout."
          exitOnError $ERROR $reason
      fi


# Configuring the realm of the LocalOSUserRegistry of WAS
echo " Configuring the realm of the LocalOSUserRegistry of WAS ...."
$PROFILEPATH/bin/wsadmin.sh -conntype SOAP -port $SOAPPORT -username $TWSUSER -password $TWSPASSWORD -f $TWS_TOOLS_DIR/configureRealm.jacl
if [ $? -ne 0 ]
then
    ERROR="68"
    reason="possible error, $ERROR, configuring the realm of the LocalOSUserRegistry of WAS, check system stderr/stdout."
    exitOnError $ERROR $reason
fi

# restart the server to make effective changes to the realm
# stopServer

      echo " Starting the server "$SERVERNAME"...."
      echo "$PROFILEPATH/bin/stopServer.sh $SERVERNAME -username $TWSUSER -password ********"
      $PROFILEPATH/bin/stopServer.sh $SERVERNAME -username $TWSUSER -password $TWSPASSWORD
      if [ $? -ne 0 ]
       then
          ERROR="69"
          reason="possible error, $ERROR, stopping the server $SERVERNAME, check system stderr/stdout."
          exitOnError $ERROR $reason
      fi
# startServer

      echo " Starting the server "$SERVERNAME"...."
      echo "$PROFILEPATH/bin/startServer.sh $SERVERNAME"
      $PROFILEPATH/bin/startServer.sh $SERVERNAME
      if [ $? -ne 0 ]
       then
          ERROR="67"
          reason="possible error, $ERROR, starting the server $SERVERNAME, check system stderr/stdout."
          exitOnError $ERROR $reason
      fi


echo " The installation of $APPNAME is complete"
echo "Exited successfully"
exit 0
