`
xkorey
  • 浏览: 153472 次
  • 性别: Icon_minigender_1
  • 来自: 石家庄
社区版块
存档分类
最新评论

websphere 命令行添加profile

阅读更多
参考链接:
http://hjs0512.iteye.com/blog/975356

websphere linux 中添加新的profile 指定管理员和新的profile相关端口。websphere版本为7.0。
1,命令如下:
/opt/IBM/WebSphere/AppServer/bin/manageprofiles.sh -create -profileName ilog -profilePath /opt/IBM/WebSphere/AppServer/profiles/ilog -templatePath /opt/IBM/WebSphere/AppServer/profileTemplates/default -nodeName DefaultNode -hostName localhost -cellName DefaultNode -isDefault -portsFile /opt/ilog.props -enableAdminSecurity true -adminUserName admin -adminPassword admin

2,profile端口ilog.props文件内容如下:
WC_defaulthost=12100
WC_adminhost=12104
WC_defaulthost_secure=12101
WC_adminhost_secure=12105
BOOTSTRAP_ADDRESS=12102
SOAP_CONNECTOR_ADDRESS=12103
SAS_SSL_SERVERAUTH_LISTENER_ADDRESS=9405
CSIV2_SSL_SERVERAUTH_LISTENER_ADDRESS=9406
CSIV2_SSL_MUTUALAUTH_LISTENER_ADDRESS=9407
ORB_LISTENER_ADDRESS=9105
DCS_UNICAST_ADDRESS=9375
IPC_CONNECTOR_ADDRESS=5563
SIB_ENDPOINT_ADDRESS=7276
SIB_ENDPOINT_SECURE_ADDRESS=7286
SIB_MQ_ENDPOINT_ADDRESS=5558
SIB_MQ_ENDPOINT_SECURE_ADDRESS=5577
SIP_DEFAULTHOST=5075
SIP_DEFAULTHOST_SECURE=5076

3,新的profile的管理员连接
http://localhost:12104/admin

admin

admin

http://localhost:12100/appName

4,删除profile
/opt/IBM/WebSphere/AppServer/bin/manageprofiles.sh -delete -profileName ilog


参考代码:
IBM Tivoli linux版 idstools下的deploy_IDSWebApp shell
shell功能:将TDS部署在WAS新的profile中。
shell代码放在附件中传不上来。
索性直接贴出来得了。
#!/bin/sh
#DEBUG=TRUE

################################################################################
#
# Header
#
# Licensed Materials - Property of IBM Corp.
# (C) Copyright IBM Corp. 2004
#
# All Rights Reserved
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

SCRIPT_VER=01.15
SCRIPT_DATE=01/18/2010
SCRIPT_SCCS=

################################################################################
#
# History
#
# DATE        Ver    Auth         Abstract
# ----------  -----  -----------  ----------------------------------
# 11/15/2004  00.01  brookh       initial design
# 11/18/204   01.00  brookh       add "-v" option
# 11/26/2004  01.01  brookh       Check server status before stop/start
# 11/26/2004  01.02  brookh       .pid file is not reliable immediately after
#                                  start/stop, so only check before first start
# 06/22/2005  01.03  dukepham     Add copying IDSWebApp.war to installableApps/SHOMEPath
#                                 and change the way this script to be executed
#                                 at <LDAPHome>/idstools/
# 05/15/2006  01.05  Amit Kumar   Support for -h, -f, -a, -e and -r options
#                                 in the deployment script
# 05/25/2006  01.06  Aalhad Saraf Remove redundant options. Integrate SunOS code.
# 06/30/2006  01.07  Amit Kumar   script should run from idstools folder
# 07/10/2006  01.08  Amit Kumar   deploy_IDSWebApp needs minor updates
# 07/18/2006  01.09  Amit Kumar   deploy_IDSWebApp -v option does not show full info
# 07/27/2009  01.10  Ripen        Added -portsFile option to wasprofile command,
#             modified copying IDSWebApp.war to
#             %WAS_HOME%\profiles\<PROFILE_NAME>\installableApps\
# 10/03/2006  01.11  Ripen        Added support for translated messages
# 02/23/2007  01.13  Pradnya Pol  Added support for -o option (ports def file)
# 04/02/2007  01.14  Ripen   Added support for jacl script(required for webadmin logs)
# 03/19/2008  D101143  Ripen    Removed extra messages
# 08/26/2008  D100650  Ripen      Incorrect location for WAR file version
# 01/08/2010  D109155  fchang     61 deploy_IDSWebApp doesn't work when called with absolute path
# 01/19/2010  D109251  fchang     deploy_IDSWebApp reports invalid war file

################################################################################
################################################################################
#
#Usage: ./deploy_IDSWebApp.sh [-v] [-h] [-w IDSWebApp.war file]
#                             [-a Application Name [-u]]
#                             [-p location of app server] [-r profile]
#                 [-o ports file]
#
# Deploys IDSWebApp.war to WAS, retaining the configuration settings of  the
# currently deployed IDSWebApp, if any.
#
#NOTE:   deploy_IDSWebApp.sh must be present in /TDS installpath/idstools folder.
#
#
#{-h     Display Usage. }
#
#{-v     Display the version and date strings for the deploy_IDSWebApp
#        script and the application war file.}
#
#{-a     Application Name. Defaults to IDSWebApp.war if not specified. }
#
#{-u     Uninstall a previously existing application.
#        -a option should be used to specify the application to uninstall
#        If not specified default application IDSWebApp.war will be
#        un-deployed.}
#
# The following options are necessary for all operations associated with
# non-embedded WAS deployments and optionally may also be used for embedded
# WAS.
#
#{-w     The fully qualified path of the IDSWebApp.war file to deploy.  }
#
#{-p     Location of WebSphere Application Server where the application is
#        to be deployed. }
#
#{-r     Profile name associated with the application. Default assumed if not
#        specified is - 'TDSWebAdminProfile'. }
#{-o     Fully qualified path of the ports definition file. Default assumed if not
#        specified is 'TDS Install directory/idstools/TDSWEBPortDef.props'. }
#
#
################################################################################
################################################################################


DEBUG_FLAG="FALSE"
MAIN_PLATFORM=`eval 'uname'`
IDSWebAppWarFileName="IDSWebApp.war"
EXETIMESTAMP=`date +"%m-%d-%y_%H-%M-%S"`
DefaultWASHOMEPath=`eval 'dirname $0'`/../appsrv/
DefaultidstoolsPath=`eval 'dirname $0'`/../idstools/
DefaultMSGPath=`eval 'dirname $0'`/../nls/msg
WAS_SERVER=server1
WASHOMEPath=
PATCH_SCRIPT=
WAS_TEMP=
APP_ROOT=
IDSWebApp_Name=
IDSToolsPath=
IDSWebApp=
NEW_IDSWebApp=
OPTION_V=FALSE
OPTION_H=FALSE
IDSWebAppInfo=WEB-INF/classes/IDSConfig/IDSWebAppInfo/IDSWebAppInfo.xml
CONFIG_FILES="\
    WEB-INF/classes/security/console_passwd \
    WEB-INF/classes/IDSConfig/IDSServersConfig/IDSServersInfo.xml \
    WEB-INF/classes/IDSConfig/IDSAppReg/IDSAppReg.xml \
    WEB-INF/classes/IDSConfig/IDSSessionConfig/IDSSessionMgmt.xml \
    "
NewIDSWebAppWarVer=
DeployedIDSWebAppWarVer=
QualifiedPath=
WAS_NODE=DefaultNode
UNINSTALL_TEMP="${WAS_HOME}/temp/uninstall_IDSWebApp.tmp"
PRE60_SERV=FALSE
UNINSTALL_ONLY=FALSE
WASPORTSPath=
WASPortsFileName=TDSWEBPortDef.props

################################################################################
#
# Set QualifiedPath of $1, or return error and clear QualifiedPath
#
QualifyPath()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ $1 ]; then
        QualifiedPath=
        save_PWD=`pwd`
        cd `dirname ${1}` || return $?
        QualifiedPath=`pwd`/`basename ${1}`
        cd ${save_PWD}
    else                    ## $1 is null
        QualifiedPath=`pwd`
    fi
}

################################################################################
#
# Delete ${WAS_HOME}/temp/uninstall_IDSWebApp.tmp directory
#  Used during uninstall_only
#
uninstall_DeleteTempDirectory()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi
    if [ -d ${UNINSTALL_TEMP} ]; then
        rm -rf ${UNINSTALL_TEMP}
    fi
}


################################################################################
#
# Create empty ${WAS_HOME}/temp/uninstall_IDSWebApp.tmp directory
# Used during uninstall_only
#
uninstall_CreateTempDirectory()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi
    uninstall_DeleteTempDirectory || return $?
    mkdir -p ${UNINSTALL_TEMP} || return $?
}

################################################################################
#
# Backup CONFIG_FILES (if any) from APP_ROOT to UNINSTALL_TEMP
# Used during uninstall_only
#
uninstall_Backup_IDSWebApp_Configuration()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    #Set up the environment variables
    if [ -d ${APP_ROOT} ]; then
        :
    else
        return 0
    fi
    for filename in ${CONFIG_FILES}; do
        if [ -f ${APP_ROOT}/${filename} ]; then
            EchoCmd mkdir -p ${UNINSTALL_TEMP}/`dirname ${filename}` || return 1
            EchoCmd cp ${APP_ROOT}/${filename} ${UNINSTALL_TEMP}/${filename} || return 1
        fi
    done

    return 0
}

################################################################################
# This function is used to only uninstall the already installed IDSWebApp.war
# application
#

uninstall_only () {

    echo ""
    if [ ${TRANSLATE_MSG} = TRUE ]; then
    cd ../bin
           ./tbindmsg ldapsh 1 40 "\nYou have chosen to UNDEPLOY %1\\\$s\n\nThe configuration files for the current application will be stored in %2\\\$s\n\n" "${IDSWebApp_Name}" "${WAS_HOME}/temp/uninstall_IDSWebApp.tmp"
    else
      echo "You have chosen to undeploy ${IDSWebApp_Name}"
   echo ""
   echo "The configuration files for the current application will be stored in ${WAS_HOME}/temp/uninstall_IDSWebApp.tmp"
    fi

    if [ -z "${IDSWebApp_Name}" ]; then
        IDSWebApp_Name="IDSWebApp.war"
    fi

    if [ ${TRANSLATE_MSG} = TRUE ]; then
      cd ../bin
        ./tbindmsg ldapsh 1 41 "\nAn application named %1\\\$s will be undeployed\n\n" "${IDSWebApp_Name}"
    else
         echo "The application ${IDSWebApp_Name} will be undeployed"
    fi

    uninstall_CreateTempDirectory || return $?
    uninstall_Backup_IDSWebApp_Configuration || return $?

    if [ ${PRE60_SERV} = FALSE ]; then
        if [ ! -f ${WAS_HOME}/profiles/${PROFILE_NAME}/logs/${WAS_SERVER}/${WAS_SERVER}.pid ]; then
            Start_WAS || return $?
        fi
    else
        if [ ! -f ${WAS_HOME}/logs/${WAS_SERVER}/${WAS_SERVER}.pid ]; then
            Start_WAS || return $?
        fi
    fi

    Uninstall_IDSWebApp
    exit 0;

}

################################################################################
# This function is used to print the help for deploy_IDSWebApp.sh
#


printusage () {

   if [ ${TRANSLATE_MSG} = TRUE ]; then
      cd ../bin
           ./tbindmsg ldapsh 1 39 "\n   Usage: deploy_IDSWebApp [-v] [-h] [-w war_file_path]\n                           [-a app_name [-u]] \n                           [-p app_server_path] [-r profile_name]\n                           [-o ports_file]\n\n   Deploys IDSWebApp.war file to WebSphere Application Server, retaining the configuration\n   settings of the currently deployed IDSWebApp, if any.\n\n   Note: deploy_IDSWebApp must be present in the /TDS installpath/idstools folder.\n\n   -a app_name         Application name, defaults to IDSWebApp.war if not specified.\n   -h                  Display the usage. \n   -u                  Uninstall a previously existing application.\n                       Option -a should be used to specify the application to uninstall.\n                       If not specified, the default application IDSWebApp.war will be undeployed.\n   -v                  Display the version and date strings for the deploy_IDSWebApp\n   	                  command and the application war file.\n\n   The following options are necessary for all operations associated with\n   non Embedded WAS deployments and optionally can also be used for Embedded WAS.\n\n   -p app_server_path  Location of WebSphere Application Server where the application is\n                       to be deployed.\n   -r profile_name     Profile name associated with the application.\n                       If not specified, the default is 'TDSWebAdminProfile'.\n   -w war_path_path    The fully qualified path of the IDSWebApp.war file to deploy.\n   -o ports_file       The fully qualified path of the ports definition file to use.\n                       If not specified, the default is 'TDS Install directory/idstools/TDSWEBPortDef.props'.\n"
   else
echo "Usage: ./deploy_IDSWebApp [-v] [-h] [-w IDSWebApp.war file]
                                [-a Application Name [-u]]
                                [-p location of app server] [-r profile]
            [-o ports file]
Deploys IDSWebApp.war to WAS, retaining the configuration settings of the
currently deployed IDSWebApp, if any.

NOTE:   deploy_IDSWebApp must be present in /TDS installpath/idstools/ folder.


{-h     Display Usage. }

{-v     Display the version and date strings for the deploy_IDSWebApp
        script and the application war file.}

{-a     Application Name. Defaults to IDSWebApp.war if not specified. }

{-u     Uninstall a previously existing application.
        -a option should be used to specify the application to uninstall
        If not specified default application IDSWebApp.war will be un-deployed.}

The following options are necessary for all operations associated with
non-embedded WAS deployments and optionally may also be used for embedded WAS.

{-w     The fully qualified path of the IDSWebApp.war file to deploy.  }

{-p     Location of WebSphere Application Server where the application is
        to be deployed. }

{-r     Profile name associated with the application. Default assumed if not
        specified is - 'TDSWebAdminProfile'. }

{-o     Fully qualified path of the ports definition file. Default assumed if not
        specified is 'TDS Install directory/idstools/TDSWEBPortDef.props'. }
"
fi
exit 0

}

################################################################################
#
# Print localized "File not found" error and return failure RC
#
AssertFileExists()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ ! -f $1 ]; then
        ls $1 >/dev/null
    fi
}

################################################################################
#
# Echo cmd and then call it
#
EchoCmd()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    echo ""
    echo "$*"
    eval "$*"
}


################################################################################
#
# Initialize all needed variables
InitGlobalVariables()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    QualifyPath $1 || return $?
    IDSToolsPath=`dirname ${QualifiedPath}`
    PATCH_SCRIPT=${QualifiedPath}

    if [ ${WASHOMEPath} ]; then
        :
    else
        QualifyPath ${DefaultWASHOMEPath} || return $?
        WASHOMEPath=${QualifiedPath}
    fi


    if [ -z "${IDSWebApp_Name}" ]; then
        IDSWebApp_Name="IDSWebApp.war"
    fi

    ## Execution of setupCmdLine.sh will set all needed environment variables
    ## such as: ${WAS_HOME} and ${JAVA_HOME} etc.
    cd "${WASHOMEPath}/bin/"

    AssertFileExists "${WASHOMEPath}/bin/setupCmdLine.sh" || return $?
    . "${WASHOMEPath}/bin/setupCmdLine.sh" || return $?

    if [ ! -f ${WAS_HOME}/bin/wasprofile.sh ]; then
        if [ -f ${WASHOMEPath}/bin/wasprofile.sh ]; then
            WAS_HOME=${WASHOMEPath}
        fi
    fi

    cd ${IDSToolsPath}

    AssertFileExists "${WASHOMEPath}/bin/wsadmin.sh" || return $?

    UNINSTALL_TEMP="${WAS_HOME}/temp/uninstall_IDSWebApp.tmp"

    if [ ! -f "${WASHOMEPath}/bin/wasprofile.sh" ]; then
        PRE60_SERV=TRUE
    fi

    WAS_TEMP="${WAS_HOME}/temp/deploy_IDSWebApp.tmp"

    APP_ROOT="${WAS_HOME}/installedApps/${WAS_NODE}/${IDSWebApp_Name}.ear/IDSWebApp.war"

    if [ ${PROFILE_NAME} ]; then
        :
    else
        PROFILE_NAME=TDSWebAdminProfile
    fi

    if [ ${PRE60_SERV} = FALSE ]; then
        APP_ROOT=${WAS_HOME}/profiles/${PROFILE_NAME}/installedApps/DefaultNode/${IDSWebApp_Name}.ear/IDSWebApp.war
    fi

    if [ ${IDSWebApp} ]; then
        NEW_IDSWebApp=${IDSWebApp}
    else
        if [ "${MAIN_PLATFORM}" = "AIX" ]; then
            AssertFileExists ${IDSToolsPath}/${IDSWebAppWarFileName?}
            if [ $? -eq 0 ]; then
                QualifyPath ${IDSToolsPath}/${IDSWebAppWarFileName?}
            else
                AssertFileExists ${IDSToolsPath}/nossl/${IDSWebAppWarFileName?} || return $?
                QualifyPath ${IDSToolsPath}/nossl/${IDSWebAppWarFileName?}
            fi
        else
            AssertFileExists ${IDSToolsPath}/${IDSWebAppWarFileName?} || return $?
            QualifyPath ${IDSToolsPath}/${IDSWebAppWarFileName?}
        fi
        NEW_IDSWebApp=${QualifiedPath}
    fi

    if [ ${WASPORTSPath} ]; then
        :
    else
        if [ "${MAIN_PLATFORM}" = "AIX" ]; then
            AssertFileExists ${IDSToolsPath}/${WASPortsFileName?}
            if [ $? -eq 0 ]; then
                QualifyPath ${IDSToolsPath}/${WASPortsFileName?}
            else
                AssertFileExists ${IDSToolsPath}/nossl/${WASPortsFileName?} || return $?
                QualifyPath ${IDSToolsPath}/nossl/${WASPortsFileName?}
            fi
        else
            AssertFileExists ${IDSToolsPath}/${WASPortsFileName?} || return $?
            QualifyPath ${IDSToolsPath}/${WASPortsFileName?}
        fi
        WASPORTSPath=${QualifiedPath}
    fi

}

################################################################################
#
# Delete ${WAS_HOME}/temp/IDSWebApp.tmp directory
#
DeleteTempDirectory()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ -d ${WAS_TEMP} ]; then
        rm -rf ${WAS_TEMP}
    fi
}

################################################################################
#
# Create empty ${WAS_HOME}/temp/IDSWebApp.tmp directory
#
CreateTempDirectory()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    DeleteTempDirectory || return $?
    mkdir -p ${WAS_TEMP} || return $?
}

################################################################################
#
# Backup CONFIG_FILES (if any) from APP_ROOT to WAS_TEMP
#
Backup_IDSWebApp_Configuration()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    ## Set up the environment variables

    if [ ! -d ${APP_ROOT} ]; then
        return 0
    fi

    for filename in ${CONFIG_FILES}; do
        if [ -f ${APP_ROOT}/${filename} ]; then
            EchoCmd mkdir -p ${WAS_TEMP}/`dirname ${filename}` || return 1
            EchoCmd cp ${APP_ROOT}/${filename} ${WAS_TEMP}/${filename} || return 1
        fi
    done

    return 0
}

################################################################################
#
# Restore CONFIG_FILES (if any) from WAS_TEMP to APP_ROOT
#
Restore_IDSWebApp_Configuration()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    for filename in ${CONFIG_FILES}; do
        if [ -f ${WAS_TEMP}/${filename} ]; then
            EchoCmd cp ${WAS_TEMP}/${filename} ${APP_ROOT}/${filename} || return 1
        fi
    done

    return 0
}


################################################################################
#
# Start WAS server1
#
Start_WAS()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ ${PRE60_SERV} = FALSE ]; then
        EchoCmd "${WAS_HOME}/profiles/${PROFILE_NAME}/bin/startServer.sh" ${WAS_SERVER} || return $?
    else
        EchoCmd "${WAS_HOME}/bin/startServer.sh" ${WAS_SERVER} || return $?
    fi
}

################################################################################
#
# Stop WAS server1
#
Stop_WAS()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi
    if [ ${PRE60_SERV} = FALSE ]; then
        EchoCmd "${WAS_HOME}/profiles/${PROFILE_NAME}/bin/stopServer.sh" ${WAS_SERVER} || return $?
    else
        EchoCmd "${WAS_HOME}/bin/stopServer.sh" ${WAS_SERVER} || return $?
    fi
}

################################################################################
#
# Restart WAS server1
#
Restart_WAS()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    Stop_WAS
    Start_WAS || return $?
}

################################################################################
#
# Un-deploy existing IDSWebApp.war (if found)...
#
Uninstall_IDSWebApp()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ -d ${APP_ROOT} ]; then
        if [ ${PRE60_SERV} = FALSE ]; then
            EchoCmd ${WAS_HOME}/bin/wsadmin.sh '-conntype NONE -profileName ${PROFILE_NAME} -c "\$AdminApp uninstall ${IDSWebApp_Name}"' || return $?
        else
            EchoCmd ${WAS_HOME}/bin/wsadmin.sh '-conntype NONE -c "\$AdminApp uninstall ${IDSWebApp_Name}"' || return $?
        fi
    fi
    return 0
}

################################################################################
#
# Deploy new IDSWebApp.war...
#
Install_IDSWebApp()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ ${PRE60_SERV} = FALSE ]; then
   cd "${WASHOMEPath}/bin/"

   if [ ! -d ${WAS_HOME}/profiles/${PROFILE_NAME} ]; then
             if [ -f  ${WAS_HOME}/bin/manageprofiles.sh ]; then
       EchoCmd ${WAS_HOME}/bin/manageprofiles.sh "-create -profileName ${PROFILE_NAME} -profilePath "${WAS_HOME}/profiles/${PROFILE_NAME}" -templatePath "${WAS_HOME}/profileTemplates/default" -nodeName DefaultNode -hostName localhost -cellName DefaultNode -isDefault -portsFile "${WASPORTSPath}""
        else
      EchoCmd ${WAS_HOME}/bin/wasprofile.sh "-create -profileName ${PROFILE_NAME} -profilePath "${WAS_HOME}/profiles/${PROFILE_NAME}" -templatePath "${WAS_HOME}/profileTemplates/default" -nodeName DefaultNode -hostName localhost -cellName DefaultNode -isDefault -portsFile "${WASPORTSPath}""
        fi
        fi

           EchoCmd ${WAS_HOME}/profiles/${PROFILE_NAME}/bin/wsadmin.sh '-conntype NONE -c "\$AdminApp install {'${NEW_IDSWebApp}'} {-configroot \"${WAS_HOME}/config\" -node DefaultNode -usedefaultbindings -nodeployejb -appname ${IDSWebApp_Name} -contextroot \"IDSWebApp\"}"'

   cd ${IDSToolsPath}
    else
        EchoCmd ${WAS_HOME}/bin/wsadmin.sh '-conntype NONE -c "\$AdminApp install {'${NEW_IDSWebApp}'} {-configroot \"$CONFIG_ROOT\" -node \"$WAS_NODE\" -usedefaultbindings -nodeployejb -appname ${IDSWebApp_Name} -contextroot \"IDSWebApp\"}"'
    fi

    return $?
}

################################################################################
#
# Display app-version and build-date of IDSWebAppInfo.xml file
#   or localized 'not found' message
#
ShowIDSWebAppInfo()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ -f $1 ]; then
        egrep '(app-version|build-date)' $1
    else
        ls $1 >/dev/null
    fi
}

################################################################################
#
# get the major version of the new war file to:
#  ${NewIDSWebAppWarMajorVer}
#
GetVersionInfo_NewIDSWebApp()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ -f ${1} ]; then
        save_PWD=`pwd`
        cd ${WAS_TEMP}
        ${JAVA_HOME}/bin/jar -xf ${1} ${IDSWebAppInfo}
        cd ${save_PWD}
    else
        return 1
    fi

    ## Get the major version of the new war file
    #AssertFileExists ${WAS_TEMP}/${IDSWebAppInfo} || return $?
    temp_ver1=`egrep '(app-version)' ${WAS_TEMP}/${IDSWebAppInfo}`
    temp_ver2=`echo ${temp_ver1} | awk -F\> '{print $2}'`
    temp_ver3=`echo ${temp_ver2} | awk -F\< '{print $1}'`
    NewIDSWebAppWarMajorVer=`echo ${temp_ver3} | awk -F\. '{print $1}'`
}

################################################################################
#
# get the major version of deployed war in WAS:
#  ${DeployedIDSWebAppWarVer}
#
GetVersionInfo_DeployedIDSWebApp()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ -f ${1} ]; then
        temp_ver1=`egrep '(app-version)' ${1}`
        temp_ver2=`echo ${temp_ver1} | awk -F\> '{print $2}'`
        temp_ver3=`echo ${temp_ver2} | awk -F\< '{print $1}'`
        DeployedIDSWebAppWarVer=`echo ${temp_ver3} | awk -F\. '{print $1}'`
    else
        return 0
    fi
}

################################################################################
#
# "-v"
# ShowVersionInfo() is made to act as a standalone entity.It would
# initialize its own varibles needed to determine the version and
# exit.
#
ShowVersionInfo()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    ## Show script version
    echo ""
    echo "${PATCH_SCRIPT}:"

    if [ ${TRANSLATE_MSG} = TRUE ]; then
         cd ../bin
         ./tbindmsg ldapsh 1 43 "Command Version: %1\\\$s\n	 Command Date: %2\\\$s\n" "${SCRIPT_VER}" "${SCRIPT_DATE}"
    else
      echo "    Script Version:  ${SCRIPT_VER}"
   echo "    Script Date: ${SCRIPT_DATE}"
    fi

    QualifyPath $1 || return $?
    IDSToolsPath=`dirname ${QualifiedPath}`
    PATCH_SCRIPT=${QualifiedPath}

    if [ ${WASHOMEPath} ]; then
        :
    else
        QualifyPath ${DefaultWASHOMEPath} || return $?
        WASHOMEPath=${QualifiedPath}
    fi

    if [ -z "${IDSWebApp_Name}" ]; then
        IDSWebApp_Name="IDSWebApp.war"
    fi

    ## Execution of setupCmdLine.sh will set all needed environment variables
    ## such as: ${WAS_HOME} and ${JAVA_HOME} etc.

    AssertFileExists "${WASHOMEPath}/bin/setupCmdLine.sh" || return $?
    . "${WASHOMEPath}/bin/setupCmdLine.sh" || return $?

    ## Show version of new IDSWebApp
    ## echo ""
    ## echo "${NEW_IDSWebApp}:"

    if [ ! -f "${WASHOMEPath}/bin/wasprofile.sh" ]; then
        PRE60_SERV=TRUE
    fi

    if [ ! -f ${WAS_HOME}/bin/wasprofile.sh ]; then
        if [ -f ${WASHOMEPath}/bin/wasprofile.sh ]; then
            WAS_HOME=${WASHOMEPath}
        fi
    fi

    APP_ROOT="${WAS_HOME}/installedApps/${WAS_NODE}/${IDSWebApp_Name}.ear/IDSWebApp.war"

    if [ ${PRE60_SERV} = FALSE ]; then
        APP_ROOT=${WASHOMEPath}/profiles/${PROFILE_NAME}/installedApps/DefaultNode/${IDSWebApp_Name}.ear/IDSWebApp.war
    fi


    echo ""
    echo "${APP_ROOT}:"

# D109251

   if [ ! -f "${APP_ROOT}/${IDSWebAppInfo}" ]; then
     if [ ! -f "${WAS_TEMP}/${IDSWebAppInfo}" ]; then
       APP_TEMP=${WASHOMEPath}/../temp/deploy_IDSWebApp.tmp
       if [ ! -f "${APP_TEMP}/${IDSWebAppInfo}" ]; then
          if [ ${TRANSLATE_MSG} = TRUE ]; then
             cd ../bin
            ./tbindmsg ldapsh 1 37 "Not a valid IDSWebApp.war file.\n"
          else
           echo "Not a valid IDSWebApp.war file. "
         fi
        else
          ShowIDSWebAppInfo ${APP_TEMP}/${IDSWebAppInfo}
        fi
      else
         ShowIDSWebAppInfo "${WAS_TEMP}/${IDSWebAppInfo}"
      fi
    else
      ShowIDSWebAppInfo ${APP_ROOT}/${IDSWebAppInfo}
    fi

    echo ""
    exit 0
}

################################################################################
#
# Copy the new war to the <WAS install path>/installableApps/ after
#  sucessfully deployed the war file.
#
Copy_NewIDSWebApp_To_InstallableApps()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ ${PRE60_SERV} = FALSE ]; then
   ## rem Check if target exist before copying over.
   if [ -f ${WAS_HOME}/profiles/${PROFILE_NAME}/installableApps/IDSWebApp.war  ]; then
       if [ $? -eq 0 ]; then
           ## Backup target file before copying if it exists
           mv ${WAS_HOME}/profiles/${PROFILE_NAME}/installableApps/IDSWebApp.war \
           ${WAS_HOME}/profiles/${PROFILE_NAME}/installableApps/IDSWebApp.war_bkup_${EXETIMESTAMP} || return $?
       fi
   fi
   ## Copy to override target
   cp -Rp ${NEW_IDSWebApp} ${WAS_HOME}/profiles/${PROFILE_NAME}/installableApps/ || return $?

     else
   AssertFileExists ${WAS_HOME}/installableApps/IDSWebApp.war

   if [ $? -eq 0 ]; then
       ## Backup target file before copying if it exists
       mv ${WAS_HOME}/installableApps/IDSWebApp.war \
       ${WAS_HOME}/installableApps/IDSWebApp.war_bkup_${EXETIMESTAMP} || return $?
   fi

   ## Copy to override target
   cp -Rp ${NEW_IDSWebApp} ${WAS_HOME}/installableApps/ || return $?
     fi
}

################################################################################
#
# Only allow to deploy war file with exact name: "IDSWebApp.war"
#
Verify_IDSWebApp_Filename()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    ## Only set -x when about to quit
    [ "${1?}" != "${IDSWebAppWarFileName?}" ] && set -x
    [ "${1?}" != "${IDSWebAppWarFileName?}" ] && return 1
    return 0
}

################################################################################
#
# Verify war file version and only allow equal of newer version to be
#  deployed into already deployed WAS installation.
#
Verify_IDSWebApp_Version()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    ## Check the war file version, and DO NOT allow back level war file
    ## to be deployed to a newer version of deployed WAS.
    if [ ${DeployedIDSWebAppWarVer} ]; then
        [ ${NewIDSWebAppWarMajorVer} -lt ${DeployedIDSWebAppWarVer} ] && set -x
        if [ ${NewIDSWebAppWarMajorVer} -lt ${DeployedIDSWebAppWarVer} ]; then
            ## Show version of new IDSWebApp
            echo ""
            echo "${NEW_IDSWebApp}:"
            ShowIDSWebAppInfo ${WAS_TEMP}/${IDSWebAppInfo}
            ## Show version of deployed IDSWebApp
            echo ""
            echo "${APP_ROOT}/${IDSWebAppInfo}:"
            ShowIDSWebAppInfo ${APP_ROOT}/${IDSWebAppInfo}
            return 1
        fi
    fi

    return 0
}

################################################################################
#
# main
#
main()
{
    if [ ${DEBUG_FLAG} = TRUE ]; then
        set -x
    fi

    if [ -d ${DefaultMSGPath} ]; then
        TRANSLATE_MSG=TRUE
    fi

    if [ ${OPTION_H} = TRUE ]; then
        printusage
    fi

    InitGlobalVariables $1 || return $?

    if [ ${OPTION_V} = TRUE ]; then
        ShowVersionInfo
    fi

    CreateTempDirectory || return $?

    GetVersionInfo_NewIDSWebApp ${NEW_IDSWebApp} || return $?
    GetVersionInfo_DeployedIDSWebApp ${APP_ROOT}/${IDSWebAppInfo}

    if [ ${UNINSTALL_ONLY} = TRUE ];then
        uninstall_only
        exit 0;
    fi

    if [ ${OPTION_V} = FALSE ]; then
        Verify_IDSWebApp_Version || return $?

        if [ ${PRE60_SERV} = FALSE ]; then
            if [ -f ${WAS_HOME}/profiles/${PROFILE_NAME}/logs/${WAS_SERVER}/${WAS_SERVER}.pid ]; then
                Stop_WAS
                if [ $? -ne 0 ]; then
                    Start_WAS || return $?
                    Stop_WAS || return $?
                fi
            fi
        else
            if [ -f ${WAS_HOME}/logs/${WAS_SERVER}/${WAS_SERVER}.pid ]; then
                Stop_WAS
                if [ $? -ne 0 ]; then
                    Start_WAS || return $?
                    Stop_WAS || return $?
                fi
            fi
        fi

        Backup_IDSWebApp_Configuration || return $?
        Uninstall_IDSWebApp || return $?
        Install_IDSWebApp || return $?
        Restore_IDSWebApp_Configuration || return $?

   Restart_WAS || return $?

   # set the logging jar to classpath
   "${WAS_HOME}/profiles/${PROFILE_NAME}/bin/wsadmin.sh" -lang jacl -f "${DefaultidstoolsPath}/setLogging.jacl" ${WAS_HOME} ${PROFILE_NAME} DefaultNode ${IDSWebApp_Name}

   Restart_WAS || return $?

        Copy_NewIDSWebApp_To_InstallableApps || return $?

        if [ ${PRE60_SERV} = FALSE ]; then
            APP_ROOT=${WAS_HOME}/profiles/${PROFILE_NAME}/installedApps/DefaultNode/${IDSWebApp_Name}.ear/IDSWebApp.war
        fi

        DeleteTempDirectory
        echo ""
        if [ ${PRE60_SERV} = TRUE ]; then
      echo "${APP_ROOT}:"
         ShowIDSWebAppInfo ${APP_ROOT}/${IDSWebAppInfo}
   fi
    fi
}

################################################################################
         ###################### MAIN PROGRAM #########################
################################################################################

if [ ${DEBUG} ]; then
   DEBUG_FLAG=${DEBUG}
fi

while getopts ":vw:p:a:r:uh" opt
do
   case $opt in
   v )
      OPTION_V=TRUE
      ;;
   w )
      AssertFileExists $OPTARG || exit $?
      QualifyPath $OPTARG || exit $?
      IDSWebApp=${QualifiedPath}
      ;;
   p )
      QualifyPath $OPTARG || exit $?
      WASHOMEPath=${QualifiedPath}
      ;;
   a )
      IDSWebApp_Name=$OPTARG
      ;;
   u )
      UNINSTALL_ONLY=TRUE
      ;;
   r )
      PROFILE_NAME=$OPTARG
      ;;
   h )
      OPTION_H=TRUE
      ;;
   o )
      QualifyPath $OPTARG || exit $?
      WASPORTSPath=${QualifiedPath}
      ;;
   \? )
      OPTION_H=TRUE
      ;;
   * )
      exit $?
      ;;
   esac
done

main $0


分享到:
评论

相关推荐

    Linux中安装WebSphere7部署手册

    你可以通过命令行创建Dmgr(管理代理)服务器,例如在`${WAS_Home}/bin`目录下运行`./manageprofiles.sh -create -templatePath /home/IBM/WebSphere/AppServer/profileTemplates/dmgr -profileName Dmgr01`,确保选择...

    Linux环境Websphere超详细安装配置文档

    【Linux环境Websphere超详细安装配置文档...在应用部署时,需要将应用程序打包成WAR或EAR文件,然后通过WebSphere控制台或命令行工具将其上传并配置到服务器上。这些后续步骤同样需要细心操作,以确保系统的稳定运行。

    WebSphere集群安装与配置手册.docx

    - **创建 AppServer 的 Profile**:在每台作为集群节点的服务器上执行。 - **配置 Node**:确保每台服务器被正确识别并加入集群。 - **创建 Cluster**:在 DMGR 上创建集群,并将各个 AppServer 添加进去。 - **配置...

    websphere项目发布

    安装WebSphere Application Server涉及到下载和运行安装程序,选择合适的安装类型(如传统模式或 Liberty Profile),并指定安装目录。安装过程中,还需要配置服务器实例、安全管理设置以及JVM参数等。 4、**建立...

    websphere安装笔记

    WebSphere中的概要文件(profile)用于定义运行时环境,包括服务器实例、配置和其他资源。当不再需要某个概要文件时,可以通过以下步骤进行删除: 1. **列出所有概要文件**:在WebSphere安装目录的相应bin目录下,...

    websphere安装配置手册

    - **Custom Profile**:空节点,可根据需要添加应用程序服务器等。 - 在安装概要文件步骤选择 None,确认安装摘要信息后点击 Next。 5. **完成安装**: - 当安装完成后,确认状态为 Success,取消勾选 Launch the...

    Websphere8.5安装配置参考文档.docx

    - 在命令行进入概要文件目录下的`bin`目录,执行`startServer server1 -profileName AppSrv01`命令。 - 通过浏览器访问`http://localhost:9060/ibm/console`登录管理控制台。 #### 六、发布应用 - **配置数据源**...

    Websphere应用服务器安装说明

    启动IBM Installation Manager,创建一个新的安装项目,然后添加Websphere Application Server Network Deployment的安装响应文件。这将指导安装过程并指定所需的安装选项。 #### 2.2 第二步: 在Installation ...

    websphere安装配置

    1. **下载Websphere安装包**:你可以从IBM Passport Advantage或者IBM官方网站下载适合你系统的Websphere版本,例如Websphere Application Server (WAS) 或者Websphere Liberty Profile。 2. **运行安装向导**:...

    WebSphere集群部署文档.doc

    通过在命令行中运行`java -version`,可以检查当前系统中安装的JDK版本。JDK是WebSphere运行的基础,因为它提供了运行时环境,使得WebSphere能够解析和执行Java应用程序。 2. **WebSphere软件的安装**: 安装...

    websphere 脚本配置

    为了简化这一过程,WAS提供了一个名为`wsadmin`的命令行工具,它允许用户通过脚本语言执行与管理控制台相同的任务。本文主要探讨如何利用`wsadmin`和Jython脚本进行自动化配置和应用部署,以提高工作效率。 ### ...

    RedHat部署WebSphere7详细手册.pdf

    ./manageprofiles.sh -create -templatePath /home/IBM/WebSphere/AppServer/profileTemplates/dmgr -profileName Dmgr01 ``` 确保模板路径正确,选择`dmgr`模板。接着,创建AppSrv02这样的应用服务器,同样使用`...

    WebSphere集群搭建实例[汇编].pdf

    7. **将IHS和插件加入集群**:通过管理控制台或命令行将IHS和插件添加到集群中。命令行方法更直接,但涉及的步骤较多。 8. **测试和验证**:启动集群和IHS,通过向IHS发送请求来验证集群是否正常工作,负载是否按照...

    REDHAT6Linux环境下WebSphere7.0安装图文手册

    - 在 `/etc/profile` 文件中添加 `WAS_HOME` 的环境变量,如 `echo "export WAS_HOME=/home/IBM/WebSphere/AppServer" &gt;&gt; /etc/profile`。 - 验证安装结果,通过点击 [Installation verification] 按钮进行。 4. ...

    linux环境搭建及WebSphere部署文档V1.0.0

    解决这些问题需要熟悉Linux命令行操作、理解WebSphere的架构以及对db2数据库管理的深入理解。此文档的目的就是提供一个参考,帮助读者在遇到问题时能够迅速找到解决方案,提高部署效率。 总结,Linux环境搭建及...

    NC6.3 产品安装部署及配置指南.pdf

    除了命令行方式外,还可以使用PMT(Profile Management Tool)向导来创建和管理profile文件。具体步骤如下: 1. **启动PMT**:在WEBSPHERE安装目录下找到PMT工具并启动。 2. **选择操作**:在PMT向导中选择“创建新...

    WebSphere Integration Developer环境搭建

    在`IBM\WID61\runtimes\bi_v61\bin`目录下,你可以找到用于管理概要文件的命令行工具。使用以下命令删除所有概要文件: ``` manageprofiles –deleteAll ``` 如果只想删除特定的概要文件,替换`–deleteAll`为`–...

    WAS 8.5 现场部署文档

    1. **创建集群管理端**:在集群管理机器上,通过`/opt/IBM/WebSphere/AppServer/bin/ProfileManagement/pmt.sh`启动Profile Management Toolkit。 2. **启动WebSphere Customization Toolbox 8.5**:用于管理...

    WAS7安装文档.doc

    安装Plugins时,需要确保它们与WebSphere版本兼容,并正确配置以指向正确的WebSphere profile。 5. **补丁升级** 保持WAS7的更新是至关重要的,这涉及到安装各种补丁以修复已知问题和提升性能。补丁升级过程包括...

Global site tag (gtag.js) - Google Analytics