#!/bin/bash
# IBM Confidential
# OCO Source Materials
# 5724-V51
#
# (c) Copyright IBM Corp. 2000, 2008 All Rights Reserved.
#
# 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.
# 
# # Copyright (c) 2000, 2004 IBM Corp. - All Rights Reserved.
# # IBM makes no representations or warranties about the suitability of
# # this program, either express or implied, including but not limited to
# # the implied warranties of merchantability, fitness for a particular
# # purpose, or non-infringement. 
# 
#


. ${TOP}/bin/get_params.sh
SVC_NAME=${_CCD_SVC_NAME:=appsvr_${SHORT_HOSTNAME}}
. ${ADMIN_DIR}/init_svc_vars.sh

WAS_APPSERVERNAME=${_CCD_APPSERVERNAME:=${WAS_APPSERVERNAME}}

case "${CCD_APPSVR}" in
    websphere6)
        InitEtcDirForAppSvr websphere
        if [ -n "$WAS_SECURITY" ]; then
            ${ECHO}
            ${ECHO} "You have indicated that WAS security is enabled.  Please provide the"
            ${ECHO} "following authentication information:"
            ${ECHO} "WAS Username:"
            read -p "> " WAS_USERNAME
            ${ECHO} "WAS Password (will not echo):"
            read -p "> " -s WAS_PASSWORD
            ${ECHO}
            ${WAS_PROFILE_HOME}/bin/stopServer.sh ${WAS_APPSERVERNAME} -username $WAS_USERNAME -password $WAS_PASSWORD
        else
            ${WAS_PROFILE_HOME}/bin/stopServer.sh ${WAS_APPSERVERNAME}
        fi
    ;;

    *)
    
    ;;
esac

${ADMIN_DIR}/abort/abort_svc.sh --svc_name=${SVC_NAME} --unbind=${_CCD_UNBIND}
