#!/usr/bin/qsh
#
# //  DESCRIPTION:
# //      Script file used to collect information
# //      from a WebSphere Application Server
# //      instance for IBM Support personnel when
# //      an error is occurring.

. $(/usr/bin/dirname $0)/setupCmdLine

# Issue error message if we are unable to determine valid profile
CMD_NAME=`basename $0`

if [ "${INV_PRF_SPECIFIED:=}" != "" ] && [ "$INV_PRF_SPECIFIED" = "true" ]
then
    ${JAVA_HOME}/bin/java -cp "${WAS_HOME}/lib/commandlineutils.jar" com.ibm.ws.install.commandline.utils.CommandLineUtils -specifiedProfileNotExists -profileName $WAS_PROFILE_NAME
    exit 1
elif [ "${WAS_USER_SCRIPT_FILE_NOT_EXISTS:=}" != "" ] && [ "$WAS_USER_SCRIPT_FILE_NOT_EXISTS" = "true" ]
then
    ${JAVA_HOME}/bin/java -cp "${WAS_HOME}/lib/commandlineutils.jar" com.ibm.ws.install.commandline.utils.CommandLineUtils -wasUserScriptFileNotExists -wasUserScript $WAS_USER_SCRIPT
    exit 1
elif [ "${NO_DFT_PRF_EXISTS:=}" != "" ] && [ "$NO_DFT_PRF_EXISTS" = "true" ]
then
    ${JAVA_HOME}/bin/java -cp "${WAS_HOME}/lib/commandlineutils.jar" com.ibm.ws.install.commandline.utils.CommandLineUtils -noDefaultProfile -commandName $CMD_NAME
    exit 1
fi

# Invoke the QWASsvccol program first
export -s QIBM_MULTI_THREADED=N
/QSYS.LIB/${WAS_LIB}.lib/QWASSVCCOL.PGM ${USER_INSTALL_ROOT} ${WAS_INSTALL_ROOT}

export -s QIBM_MULTI_THREADED=N
${JAVA_HOME}/bin/java ${JAVA_PARM} \
  com.ibm.ws.bootstrap.WSLauncher \
  com.ibm.websphere.rastools.collector.Collector \
    -Logfile ${USER_INSTALL_ROOT}/logs/Collector.log \
    -ConfigRoot ${CONFIG_ROOT} \
    -InstallRoot ${WAS_INSTALL_ROOT} \
    -Inventory ${WAS_INSTALL_ROOT}/properties/default.inventory \
    -WasNode ${WAS_NODE} -CellName ${WAS_CELL} "$@"

