#!/bin/sh
#++
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 
#
#    NAME
#      emCCRCollector - internal script that invokes the collection
#
#    DESCRIPTION
#      This script is internally invoked to trigger a collection
#      NOTE: Do not invoke directly
#
# Exit codes
#    0 - Success
#    1 - Prerequisite check failure
#
#    Other messages returned from Collector.java 
#    5 - returned by Collector.java when a new update was detected 
#    12 - License was declined
#    50+ - Diagnostic command failures

SUCCESS=0
ERR_PREREQ_FAILURE=1

# This function wraps the ERROR writing that needs to go to STDERR in a
# function for consistency. Requires the string be passed as a singular
# argument.
ERROR()
{
    $ECHO "$@" 1>&2
}

setHostName()
{
  CCR_HOST_NAME=`hostname`
  export CCR_HOST_NAME
}

setOCMDirPaths()
{
_ccrCfgHome=""
_oracleCfgHome=""
  # Check whether its a shared OCM install
  if [ ${_sharedHomesSupported} -eq 0 ]
  then
    if [ -z "${ORACLE_CONFIG_HOME}" ]
    then
      CCR_CONFIG_HOME="${CCR_HOME}/hosts/${CCR_HOST_NAME}"
    elif [ -d ${ORACLE_CONFIG_HOME} ]
    then
      _isRelative=`$ECHO ${ORACLE_CONFIG_HOME} | $EGREP -c '^/'`
      if [ ${_isRelative} -eq 0 ] ; then
        $ECHO '$ORACLE_CONFIG_HOME refers to a relative path.'
        $ECHO 'Redefine ORACLE_CONFIG_HOME to refer to an absolute path, or'
        $ECHO 'unset it if the configuration state is in the ccr directory tree.'
        exit $ERR_PREREQ_FAILURE
      else
        # strip any trailing dirsep
        ORACLE_CONFIG_HOME=`$ECHO ${ORACLE_CONFIG_HOME} | $SED -e 's/\/*$//'`
        CCR_CONFIG_HOME="${ORACLE_CONFIG_HOME}/ccr"
        _oracleCfgHome="-DORACLE_CONFIG_HOME=${ORACLE_CONFIG_HOME}"
      fi
    else
      $ECHO '$ORACLE_CONFIG_HOME should point to the directory containing OCM configurations for the host.'
      exit $ERR_PREREQ_FAILURE
    fi
  else
    CCR_CONFIG_HOME=${CCR_HOME}
  fi
  _ccrCfgHome="-DCCR_CONFIG_HOME=${CCR_CONFIG_HOME}"
  export CCR_CONFIG_HOME
}

determineJavaVersion()
{
    java_version=`${JAVA_HOME}/bin/java -version 2>&1`
    cmd_exit=$?
    java_version=`$ECHO $java_version | \
                  $EGREP 'java version' | $CUT -d'"' -f2 | $CUT -d'"' -f1`
    G_JAVA_MAJOR_VERSION=`$ECHO $java_version | $CUT -d'.' -f1`
    G_JAVA_MINOR_VERSION=`$ECHO $java_version | $CUT -d'.' -f2`
}

determineHttpClientClasspath()
{
    G_HTTP_CLIENT_CLASSPATH="${CCR_HOME}/lib/http_client_11116.jar" 
    if [ "$G_JAVA_MINOR_VERSION" = "2" -o \
         "$G_JAVA_MINOR_VERSION" = "3" -o \
         "$G_JAVA_MINOR_VERSION" = "4" -o \
         "$G_JAVA_MINOR_VERSION" = "5" ]
    then
        G_HTTP_CLIENT_CLASSPATH="${CCR_HOME}/lib/http_client_12.jar" 
    fi  
    export G_HTTP_CLIENT_CLASSPATH
}

#
# Reset the locale to ENGLISH for command line operations.
LC_ALL=C
export LC_ALL

# Define the paths for /usr/bin. These are used in subsequent path
# specifications for native commands.
_binDir=/bin
_usrBinDir=/usr/bin

# Set the variables that map to explicit paths to prevent from trojan
# horse type attacks and allow for more consistent installation experience
# by eliminating the use of aliases.
AWK=${_binDir}/awk
CHMOD=${_binDir}/chmod
DIRNAME=${_usrBinDir}/dirname
ECHO=${_binDir}/echo
MKDIRP="${_binDir}/mkdir -p"
SED=${_binDir}/sed
TR=${_usrBinDir}/tr

if [ -f ${_binDir}/cut ]
then
    CUT=${_binDir}/cut
elif [ -f ${_usrBinDir}/cut ]
then
    CUT=${_usrBinDir}/cut
fi

if [ -f ${_binDir}/egrep ]
then
    EGREP=${_binDir}/egrep
elif [ -f ${_usrBinDir}/egrep ]
then
    EGREP=${_usrBinDir}/egrep
fi

if [ -f ${_binDir}/uname ]
then
    UNAME=${_binDir}/uname
elif [ -f ${_usrBinDir}/uname ]
then
    UNAME=${_usrBinDir}/uname
fi

#
# Set the umask for all operations
umask 077

# Use the UNAME output for the platform name.
_platform=`$UNAME | $CUT -f1 -d' '`

if [ "${_platform}" = "OSF1" ]
then
    if [ -z "${BIN_SH}" ]
    then
        BIN_SH=xpg4
        export BIN_SH
        $0 "$@"
        exit $?
    fi
fi 

ROOTCHAR=`$DIRNAME $0 | $CUT -b1`
if [ "${ROOTCHAR}" != "/" -a -z "${PWD}" ]
then
    $ECHO "The current shell is not supported for executing commands using relative paths."
    $ECHO "Either execute the command under the bash or ksh shells, or execute the "
    $ECHO "command using the absolute path."
    exit 1
fi

# Extract the binary directory specification where this script resides. 
# The enclosed code will come up with an absolute path. 
_liveLinkLibDir=`$DIRNAME $0 | $TR -s '/'`
_liveLinkLibDir=`$ECHO $_liveLinkLibDir | $AWK -f ${_liveLinkLibDir}/../bin/strip_path.awk PWD=$PWD`
_liveLinkRootDir=`$DIRNAME $_liveLinkLibDir`
_liveLinkBinDir=${_liveLinkRootDir}/bin

CCR_HOME=$_liveLinkRootDir
export CCR_HOME

#
# Determine if Shared Oracle Home support is available. This is determined
# thru the new directory 'hosts' under the CCR_HOME.
#
if [ -d "${CCR_HOME}/hosts" ]; then
    _sharedHomesSupported=0
else
    _sharedHomesSupported=1
fi

setHostName
setOCMDirPaths

# Check for OCM stanadlone mode
if [ -f ${_liveLinkRootDir}/bin/nmz ]
then
  _isGridAgentHome=0
else
  _isGridAgentHome=1
  if [  ! -z "${EMSTATE}" ] 
  then
    _emState=${EMSTATE}
  else
    _emState=${_liveLinkRootDir}
  fi
  _emStateProp="-DEMSTATE=${_emState}"
fi

#
# If the log directory does not exist, create it as it will be needed
# for the installation of the packages.
#
if [ "${_isGridAgentHome}" = "1" ]
then
  _liveLinkLogHome="${_emState}/sysman/log"
else
  _liveLinkLogHome="${CCR_CONFIG_HOME}/log"
fi

if [ ! -d ${_liveLinkLogHome} ]
then
   $MKDIRP ${_liveLinkLogHome}
   $CHMOD 740 ${_liveLinkLogHome}
fi

#
# Create the base inventory tree if it is not present. This is not needed
# in a Grid Agent Home since there is no package update from the Content
# Server
#
if [ "${_isGridAgentHome}" = "0" ]
then
  if [ ! -d ${_liveLinkRootDir}/inventory/pending ]
  then
     $MKDIRP ${_liveLinkRootDir}/inventory/pending
     $CHMOD -R 0740 ${_liveLinkRootDir}/inventory
  fi
fi

# Create the state directories if not present
if [ "${_isGridAgentHome}" = "1" ]
then
  _liveLinkStateHome="${_emState}/sysman/cmdb"
else
  _liveLinkStateHome="${CCR_CONFIG_HOME}"
fi

if [ ! -d ${_liveLinkStateHome} ]
then
   $MKDIRP ${_liveLinkStateHome}
   $CHMOD 740 ${_liveLinkStateHome}
fi
if [ ! -d ${_liveLinkStateHome}/state ]
then
   $MKDIRP ${_liveLinkStateHome}/state
   $CHMOD 740 ${_liveLinkStateHome}/state
   $MKDIRP ${_liveLinkStateHome}/state/previous
   $CHMOD 740 ${_liveLinkStateHome}/state/previous
   $MKDIRP ${_liveLinkStateHome}/state/upload
   $CHMOD 740 ${_liveLinkStateHome}/state/upload
   $MKDIRP ${_liveLinkStateHome}/state/temp
   $CHMOD 740 ${_liveLinkStateHome}/state/temp
fi

if [ ! -z "${JAVA_HOME}" ]
then
   unset JAVA_HOME
fi

# Source the user specified environment that is present in the CCR environment
# snapshot file (maintained by emSnapshotEnv).
if [ -f ${CCR_CONFIG_HOME}/config/emCCRenv ]
then
    . ${CCR_CONFIG_HOME}/config/emCCRenv
fi

# LiveLink is expanded into a home, so the the parent of the install *IS* the
# Oracle home. For Grid Agent installations the Oracle home is the parent of
# the lib directory
if [ "${_isGridAgentHome}" = "0" ]
then
  _oracleHome=`$DIRNAME ${_liveLinkRootDir}`
else
  _oracleHome=`$DIRNAME ${_liveLinkLibDir}`
fi
_collectorJar=${_liveLinkLibDir}/emCCR.jar
_jreLib=${_oracleHome}/JRE/lib

_classpath=""
if [ "${_isGridAgentHome}" = "1" ]
then
  agent_classpath_file="$_oracleHome/sysman/config/classpath.lst"
  # We may require some classes from Agent SDK, RT and paths 
  # of jars for third party server libs to run third party server collection fetchlets
  if [ -f ${agent_classpath_file} ]
  then
    _classpath=` grep -v "^[[:space:]]*#.*" ${agent_classpath_file} | tr "\n" ":"`
    # Add required Agent jars to class path
    _classpath=$_classpath:"$_oracleHome/sysman/jlib/emagentSDK.jar"
    _classpath=$_classpath:"$_oracleHome/sysman/jlib/emagentRT.jar"
    _classpath=$_classpath:"$_oracleHome/jdbc/lib/ojdbc5.jar"
    _classpath=$_classpath:"$_oracleHome/sysman/jlib/emocmgc.jar"
    _classpath=$_classpath:"$_oracleHome/sysman/jlib/log4j-core.jar"
    _classpath=$_classpath:"$_oracleHome/sysman/jlib/regexp.jar"
    _classpath=$_classpath:"$_oracleHome/jlib/http_client.jar"
    _classpath=$_classpath:"$_oracleHome/jlib/xmlparserv2.jar"
  else
    ERROR "Could not find ${agent_classpath_file}." 
  fi
fi

if [ ! -z "${JAVA_HOME}" ]
then
   _JAVA_BIN_PATH=${JAVA_HOME}/bin
fi

if [ ! -f ${_JAVA_BIN_PATH}/java ]
then
   _JAVA_BIN_PATH=${_oracleHome}/jdk/bin
fi

if [ ! -f ${_JAVA_BIN_PATH}/java ]
then
   _JAVA_BIN_PATH=${_oracleHome}/jre/bin
fi

if [ ! -f ${_JAVA_BIN_PATH}/java ]
then
    ERROR "The \$ORACLE_HOME/jdk/bin does not contain a java executable or the "
    ERROR "\$JAVA_HOME\bin is lacking the executable image."
    ERROR "Define the JAVA_HOME environmental variable to a JDK that is V1.2.2"
    ERROR "or greater and reissue the command."
    exit $ERR_PREREQ_FAILURE
else
    JAVA_HOME=`$DIRNAME ${_JAVA_BIN_PATH}`
fi

determineJavaVersion
determineHttpClientClasspath
_classpath=${G_HTTP_CLIENT_CLASSPATH}:${_collectorJar}:${_classpath}

# determine OS architecture - IBM JVM needs special consideration for SSL
# per bug 5894282
_bootClassPath=""
_osArch=`${_JAVA_BIN_PATH}/java -cp ${G_HTTP_CLIENT_CLASSPATH}:${_liveLinkLibDir}/emocmcommon.jar:${_liveLinkLibDir}/emocmutl.jar:${_liveLinkLibDir} OsInfo`
if [ "${_osArch}" = "ppc" -o \
     "${_osArch}" = "ppc64" -o \
     "${_osArch}" = "s390" -o \
     "${_osArch}" = "s390x" ]; then 
    _bootClassPath="-Xbootclasspath/a:${_liveLinkLibDir}/jcert.jar:${_liveLinkLibDir}/jnet.jar:${_liveLinkLibDir}/jsse.jar:${_liveLinkLibDir}/log4j-core.jar:${_liveLinkLibDir}/regexp.jar"
fi

#
# Pass the TNS_ADMIN variable if set 
#
_tnsAdmin=""
if [ ! -z "${TNS_ADMIN}" ]
then
   _tnsAdmin="-DTNS_ADMIN=${TNS_ADMIN}"
fi

# 
# Pass the ORACLE Inventory location if it was specified for override
#
_oraInst_loc=""
if [ ! -z "${ORAINST_LOC}" ]
then
    _oraInst_loc="-DORAINST_LOC=${ORAINST_LOC}"
fi

#
# Pass an alternate HOSTNAME for this host if it is required
#
_hostname=""
if [ ! -z "${_HOSTNAME}" ]
then
    _hostname="-Doracle.sysman.ccr.hostname=${_HOSTNAME}"
fi

#
# Pass an alternate emtab for this host if it is required
#
_emTab=""
if [ ! -z "${EMTAB}" ]
then
    _emTab="-DEMTAB=${EMTAB}"
fi

# 
# Pass along the user specified ORACLE_HOME if it was found.
#
_userOracleHome=""
if [ ! -z "${ORACLE_HOME}" ]
then
    _userOracleHome="-DUSER_ORACLE_HOME=${ORACLE_HOME}"
fi

#
# Pass the EMAGENT Trace env variable if present
#
_emagent_perl_trace=""
if [ ! -z "${EMAGENT_PERL_TRACE_LEVEL}" ]
then
    _emagent_perl_trace="-DEMAGENT_PERL_TRACE_LEVEL=${EMAGENT_PERL_TRACE_LEVEL}"
fi

#
# Pass the CRS_HOME variable if present
#
_crs_home=""
if [ ! -z "${CRS_HOME}" ]
then
    _crs_home="-DCRS_HOME=${CRS_HOME}"
fi

#
# Pass the CLUSTER_NAME variable if present
#
#
_cluster_name=""
if [ ! -z "${CLUSTER_NAME}" ]
then
    _cluster_name="-DCLUSTER_NAME=${CLUSTER_NAME}"
fi

#
# Pass LD_PRELOAD if specified
_ld_preload=""
if [ ! -z "${LD_PRELOAD}" ]
then
    _ld_preload="-DLD_PRELOAD=${LD_PRELOAD}"
fi

_jit_flag=""

#
# For test purposes... you can define this
_ccrtest_do_not_designate_as_central_anonymous_collector=""
if [ ! -z "${ccrtest_do_not_designate_as_central_anonymous_collector}" ]
then
    _ccrtest_do_not_designate_as_central_anonymous_collector="-Dccrtest_do_not_designate_as_central_anonymous_collector=true"
fi

#
#
# For test purposes... you can define this
_ccrtest_do_not_silence_anonymous_central_collector=""
if [ ! -z "${ccrtest_do_not_silence_anonymous_central_collector}" ]
then
    _ccrtest_do_not_silence_anonymous_central_collector="-Dccrtest_do_not_silence_anonymous_central_collector=true"
fi

# For test purposes... you can define these to control max upload
_ccrtest_show_anonymous_central_collection=""
_ccrtest_maxupload_support_all_targets=""
if [ ! -z "${ccrtest_show_anonymous_central_collection}" ]
then
    _ccrtest_show_anonymous_central_collection="-Dccrtest_show_anonymous_central_collection=true"
fi
if [ ! -z "${ccrtest_maxupload_support_all_targets}" ]
then
    _ccrtest_maxupload_support_all_targets="-Dccrtest_maxupload_support_all_targets=true"
fi

#
# Pass along the shared library path. The shared library path is defined
# as a system property that equates to a string that is a name/value pair
# that is comma separated. In a Grid Agent home, the collector uses the 
# agent's Perl installation
#
if [ "${_isGridAgentHome}" = "1" ]
then
  # PLATFORM will only be instantiated in a Grid Agent
  OUI_LIB=${_oracleHome}/oui/lib/#PLATFORM#

  if [ "$LD_LIBRARY_PATH" = "" ] ; then
    LD_LIBRARY_PATH=${_oracleHome}/lib:${_oracleHome}/perl/lib:$OUI_LIB
  else
    LD_LIBRARY_PATH=${_oracleHome}/lib:${_oracleHome}/perl/lib:$OUI_LIB:$LD_LIBRARY_PATH
  fi

  if [ "$SHLIB_PATH" = "" ] ; then
    SHLIB_PATH=${_oracleHome}/lib32:${_oracleHome}/perl/lib:${_oracleHome}/lib:$OUI_LIB
  else
    SHLIB_PATH=${_oracleHome}/lib32:${_oracleHome}/perl/lib:${_oracleHome}/lib:$OUI_LIB:$SHLIB_PATH
  fi

  if [ "$LIBPATH" = "" ] ; then
    LIBPATH=${_oracleHome}/lib32:${_oracleHome}/perl/lib:${_oracleHome}/lib:$OUI_LIB
  else
    LIBPATH=${_oracleHome}/lib32:${_oracleHome}/perl/lib:${_oracleHome}/lib:$OUI_LIB:$LIBPATH
  fi

  # JRE_EXTDIR will only be instantiated in a Grid Agent
  JRE_HOME=${_oracleHome}#JRE_EXTDIR#

  if [ "${_platform}" = "HP-UX" ]
  then
      SHLIB_PATH=$JRE_HOME/lib/PA_RISC2.0/hotspot:$JRE_HOME/lib/PA_RISC2.0:$SHLIB_PATH
      if [ "${_osArch}" = "ia64" ]
      then
        SHLIB_PATH=$JRE_HOME/lib/IA64N/hotspot:$JRE_HOME/lib/IA64N:$SHLIB_PATH
      fi
      _shlib_path="-DSHLIB_VAR=SHLIB_PATH=$SHLIB_PATH"
  elif [ "${_platform}" = "AIX" ]
  then
      _shlib_path="-DSHLIB_VAR=LIBPATH=$JRE_HOME/bin/classic:$JRE_HOME/bin:$LIBPATH"
      _jit_flag="-Djava.compiler=NONE"
  elif [ "${_platform}" = "OSF1" ]
  then
      _shlib_path="-DSHLIB_VAR=LD_LIBRARY_PATH=$JRE_HOME/lib/alpha/classic:$JRE_HOME/lib/alpha:$LD_LIBRARY_PATH"
  elif [ "${_platform}" = "SunOS" ]
  then
      if [ "${_osArch}" = "i86pc" ]
      then
        LD_LIBRARY_PATH=$JRE_HOME/lib/i386/client:$JRE_HOME/lib/i386:$LD_LIBRARY_PATH
      else
        LD_LIBRARY_PATH=$JRE_HOME/lib/sparc/client:$JRE_HOME/lib/sparc:$LD_LIBRARY_PATH
      fi
      LD_LIBRARY_PATH=/usr/lib/lwp:$LD_LIBRARY_PATH
      _shlib_path="-DSHLIB_VAR=LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
  elif [ "${_platform}" = "Linux" ]
  then
      LD_LIBRARY_PATH=$JRE_HOME/lib/i386/client:$JRE_HOME/lib/i386:$LD_LIBRARY_PATH
      if [ "${_osArch}" = "ia64" ]
      then
        LD_LIBRARY_PATH=$JRE_HOME/lib/ia64/server:$JRE_HOME/lib/ia64:$LD_LIBRARY_PATH
      elif [ "${_osArch}" = "s390x" -o "${_osArch}" = "ppc64" ]
      then
        LD_LIBRARY_PATH=$JRE_HOME/bin/classic:$JRE_HOME/bin:$LD_LIBRARY_PATH
      fi
      _shlib_path="-DSHLIB_VAR=LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
  else
      _shlib_path="-DSHLIB_VAR=LD_LIBRARY_PATH=${_oracleHome}/lib"
  fi
else
  if [ "${_platform}" = "HP-UX" ]
  then
      _shlib_path="-DSHLIB_VAR=SHLIB_PATH=${_oracleHome}/ccr/engines/${_platform}/perl/lib/5.8.3"
  elif [ "${_platform}" = "AIX" ]
  then
      _shlib_path="-DSHLIB_VAR=LIBPATH=${_oracleHome}/ccr/engines/${_platform}/perl/lib/5.8.3"
      _jit_flag="-Djava.compiler=NONE"
  else
      _shlib_path="-DSHLIB_VAR=LD_LIBRARY_PATH=${_oracleHome}/ccr/engines/${_platform}/perl/lib/5.8.3"
  fi
fi

if [ "${_isGridAgentHome}" = "1" ]
then
  # Check for PERL_HOME which is set when running remotely
  if [ ! -z "${PERL_HOME}" ]
  then 
    _perlHome="${PERL_HOME}"
  else
    # this is running in a local agent
    _perlHome="${_oracleHome}/perl"
  fi
else
  _perlHome="${_oracleHome}/ccr/engines/${_platform}/perl"
fi

#
# pass along PERL5LIB
#
_perl5lib="-DPERL5LIB=${_perlHome}/lib/site_perl:${_perlHome}/lib"

#
# pass CCR_JAVA_HOME (path to either JAVA_HOME or ORACLE_HOME/jdk)
#
if [ ! -z "${JAVA_HOME}" ]
then
   _ccrJavaHome="-DCCR_JAVA_HOME=${JAVA_HOME}"
else
   _ccrJavaHome="-DCCR_JAVA_HOME=${_oracleHome}/jdk"
fi

if [ ! -z "${TZ}" ]
then
   _tz="-DTZ=${TZ}"
else
   _tz=""
fi

#
# Bug 5971697: When CCR is executed in an APH, the scripts that use OCI need to go 
#              over JDBC instead. Following env vars control that behavior for scripts.
#
if [ ! -z "${AGENTPROXYHOME}" ]
then
   _aph="-DAGENTPROXYHOME=${AGENTPROXYHOME}"
else
   _aph=""
fi

if [ ! -z "${JDBC_OCI_SWITCH}" ]
then
   _joci="-DJDBC_OCI_SWITCH=${JDBC_OCI_SWITCH}"
else
   _joci=""
fi

#
# Allow for port override.
_ocmEndpoint=""
if [ ! -z "${ORACLE_OCM_SERVICE}" ]; then
    _ocmEndpoint="-Docm.endpoint=${ORACLE_OCM_SERVICE}"
fi

#
# End Bug 5971697 specific changes
#

#
# EBS-related environmental
#
_iasCfgHome=""
if [ ! -z "${IAS_CONFIG_HOME}" ]
then
   _iasCfgHome="-DIAS_CONFIG_HOME=${IAS_CONFIG_HOME}"
fi

#
# WLS-related environmental
#
_wlHome=""
if [ ! -z "${WL_HOME}" ]
then
   _wlHome="-DWL_HOME=${WL_HOME}"
fi
_beaHome=""
if [ ! -z "${BEA_HOME}" ]
then
   _beaHome="-DBEA_HOME=${BEA_HOME}"
fi

#
# IDM-related environmental
#
_oracleInstance=""
if [ ! -z "${ORACLE_INSTANCE}" ]
then
   _oracleInstance="-DORACLE_INSTANCE=${ORACLE_INSTANCE}"
fi

#
# Test-related environmental
#
_oracleCCRTests=""
if [ ! -z "${ORACLE_CCR_TESTS}" ]
then
   _oracleCCRTests="-DORACLE_CCR_TESTS=${ORACLE_CCR_TESTS}"
fi

if [ "$1" = "diagchecks" ]
then
 exec ${_JAVA_BIN_PATH}/java ${_ccrtest_maxupload_support_all_targets} ${_ccrtest_show_anonymous_central_collection} ${_ccrtest_do_not_silence_anonymous_central_collector} ${_ccrtest_do_not_designate_as_central_anonymous_collector} -DORACLE_HOME=${_oracleHome} -DCCR_HOME=${CCR_HOME} ${_ccrCfgHome}  -DPLATFORM=${_platform}  ${_ccrJavaHome} -DLOG_HOME=${_liveLinkLogHome} -classpath "${_classpath}" oracle.sysman.ccr.collector.cli.Cli "$@"
else
# Bug 9546156 - increased JVM stack size to 500K due to SQLFetchlet hang
# Bugfix 9657539 - Back out the -Xss arg put in as part of Bugfix 9546156,
# since setup.collector_osd failed in LINUX.IA64 because of this.
# Bugfix 9546156 is still intact however, because that was a strictly NT
# specific bug and the -Xss arg is still there in the vbs file.
 exec ${_JAVA_BIN_PATH}/java -Xmx220m ${_bootClassPath} ${_ccrtest_maxupload_support_all_targets} ${_ccrtest_show_anonymous_central_collection} ${_ccrtest_do_not_silence_anonymous_central_collector} ${_ccrtest_do_not_designate_as_central_anonymous_collector} ${_ocmEndpoint} ${_tz} ${_joci} ${_aph} ${_ccrCfgHome} ${_oracleCfgHome} ${_iasCfgHome} ${_wlHome} ${_beaHome} ${_oracleInstance} -DAGENT_HOME=${_isGridAgentHome} ${_emStateProp} -DORACLE_HOME=${_oracleHome} -DCCR_HOME=${CCR_HOME} -DPLATFORM=${_platform} ${_userOracleHome} ${_cluster_name} ${_crs_home} ${_shlib_path} ${_jit_flag} ${_tnsAdmin} ${_oraInst_loc} ${_emTab} ${_hostname} ${_emagent_perl_trace} ${_ld_preload} ${_perl5lib} ${_ccrJavaHome} ${_oracleCCRTests} -DLOG_HOME=${_liveLinkLogHome} -DPERL_HOME=${_perlHome} -DSTATE_HOME=${_liveLinkStateHome} -classpath "${_classpath}" oracle.sysman.ccr.collector.Collector "$@"
fi
