Environment Introduction

The client is migrating J2EE middleware hosting platforms to Redhat JBoss application servers. There is currently no process for provisioning or managing JBoss.

The Objective

The solution must provide a framework for provisioning and managing all JBoss instances with a secured access controlled environment. Functionality should include JBoss binary deployment and install, JBoss instance creation, instance configuration capabilities and instance change tracking.

Outside of the JBoss automation, the client required a solution that did not depend on access to the BSA UI as training for application developers and operations on BSA was not desirable or cost effective. The solution needs to facilitate a self service capability to allow for tasks to be executed outside of the UI.

Design Summary

As JBoss application server can create multiple instances per host (RSCD target) then the solution was dependant on creating BSA Component objects with the necessary property values stored against that component. All jobs execution should be against the Component and hence automatically map to Component property values.

The design also needed to ensure that users are able to execute jobs outside of the BSA console and hence NSH scripts must be designed requiring a minimal number of arguments to be passed to the script. As a result, the solution is based on the application name and environment as arguments in order for the self service scripts to logically identify the correct BSA objects to create and use for all tasks. Additional arguments will be passed where necessary.

RBAC requirements meant that a power RBAC Role could commission and provision new environments, but authorizations should be applied to the new environment objects that restrict access to those objects to AD groups as specified in the commissioning process.

Scripts

Please note the following scripts were tested and functional but are specific to customer RBAC requirements.

Script to Commission a new JBoss environment

  • Takes a populated properties file as input
  • Creates all RBAC Roles if they do not exist based on the JBossUser specified
  • Creates users and maps this to the JBossUser Roles. Based on the AD groups properties and the Environment.
  • Creates all Depot, Job and Component workspace and applies ACL Templates based on the ApplicationName and JBossUser property
  • Creates an NSHScript Job that calls the JBossInstanceDeployment script. Populates all properties file values. Sets the ACL Template based on the Environment property
  • Creates anDeploy Job that calls the JBossInstanceStartStopThreads BLPackage. Sets the ACL Template based on the Environment property.
  • Creates anDeploy Job that calls the JBossInstanceStartStopThreads BLPackage. Sets the ACL Template based on the Environment property.

#!/bin/nsh

#######################################################################

#Script to commission a new JBoss environment.

#

#Scott Dunbar 08/05/12

#Version 1.0

#######################################################################

#set -eE

#set -x

blcli_setoption serviceProfileName DEV

blcli_setoption roleName APPAdmins

blcli_connect

_JHUAdminADGroup="asdas"

fatal() {

echo"$*"

exit

}

debug() {

echo"DEBUG:$*"

}

#########

TMP_FILE="/tmp/instanceCommission.$$"

#Check if props file exits

PROPS_FILE=$1

if [ ! -f "${PROPS_FILE}" ] ; then

fatal"Propsfile(${PROPS_FILE})doesnotexist"

else

source ${PROPS_FILE}

if [ $? -ne 0 ]; then

fatal"Cannotfindthespecifiedpropertiesfile"

fi

debug"Propsfile(${PROPS_FILE})exists"

fi

if [ $? -ne 0 ] ; then

if [ -n "$3" ] ; then

blcred cred -acquire -username "$2" -password "$3"

else

blcred cred -acquire

fi

fi

# Check all required variables set

if [ -z "$_ApplicationName" ] ; then

fatal Missing required parameter _ApplicationName

fi

if [ -z "$_SUPP_TEAM1" ] ; then

fatal Missing required parameter _SUPP_TEAM1

fi

if [ -z "$_Environment" ] ; then

fatal Missing required parameter _Environment

fi

if [ -z "$_JavaHome" ] ; then

fatal Missing required parameter _JavaHome

fi

if [ -z "$_JavaXMS" ] ; then

fatal Missing required parameter _JavaXMS

fi

if [ -z "$_JBossUser" ] ; then

fatal Missing required parameter _JBossUser

fi

if [ -z "$_JBossVersion" ] ; then

fatal Missing required parameter _JBossVersion

fi

if [ -z "$_SUPP_TEAM2" ] ; then

fatal Missing required parameter _SUPP_TEAM2

fi

if [ -z "$_JBossClusteringEnabled" ]; then

_JBossClusteringEnabled=false

fi

if [ -z "$_JBossClusterMembers" ]; then

_JBossClusterMembers=0

fi

if [ -z "$_JBossClusterMulticastAddress" ]; then

_JBossClusterMulticastAddress=0

fi

if [ -z "$_JBossClusterMulticastPort" ]; then

_JBossClusterMulticastPort=0

fi

if [ -z "$_JBossClusterName" ]; then

_JBossClusterName=0

fi

_Environment=`echo $_Environment | tr '[:upper:]' '[:lower:]'`

_JBossUser=`echo $_JBossUser | tr '[:lower:]' '[:upper:]'`

_BusinessAreaUser=`echo $_JBossUser | cut -c 1-7`

#######################################################################

# Set some expected paramerters

#######################################################################

#HOSTNAME=$1

#HOSTNAME=`print $HOSTNAME|tr '[ ]' '[]'`

#echo "The target is [${HOSTNAME}]"

NshScriptPath="/JBoss/Common"

NshScriptName="JBossInstanceDeployment"

NshScriptName2="JBossInstanceStartStopThreads"

NshScriptName3="JBossInstanceChangeSystem.sh"

BlPackageName1="ChangeSystem.sh"

BlPackageName2="StartStopThreads"

InstanceTemplatePath="/JBoss/Instance"

InstanceTemplateName="Instance"

JobPath="/JBoss/ApplicationManagement"

DepotPath="/JBoss/ApplicationManagement"

CommonDepotPath="/JBoss/Common"

DevComponentGroup="/JBoss/Application/Development"

UatComponentGroup="/JBoss/Application/UAT"

ProdComponentGroup="/JBoss/Application/Production"

ProdDeploymentGroup="/Production/ApplicationDeployment"

DevDeploymentGroup="/Development/ApplicationDeployment"

UatDeploymentGroup="/UAT/ApplicationDeployment"

ldapConnectionName="aserver.adomain.com"

automationPrincipalName="AD_Read_User"

userQueryName="UserQuery"

RepoServer="aserver.adomain.com"

RepoPath="/c/JAH"

#SQL Args

DbAdDomain="INTRANET"

DbAdUser="whiterob"

DbHost="LDNDCM05673V05A"

DbPort="10501"

DbUser="sysbwaggui"

DbPassword="pa55word"

DbName="bWAGConsoleDev"

#########

#Ensure that the username matches the environment specified

#########

CheckEnv=$(echo ${_Environment} | tr '[:upper:]' '[:lower:]' | cut -c 1)

CheckUser=$(echo ${_JBossUser} | tr '[:upper:]' '[:lower:]' | cut -c 8)

if [ "x$CheckEnv" != "x$CheckUser" ]; then

fatal"TheJBossUseryouhavespecifieddoesnotappeartomatchtheEnvironmentthatyouarecreatingtheseinstancesfor"

fi

check_already_exists()

{

blcli_execute NSHScriptJob isJobExistsByGroupAndName "$JobPath/${_ApplicationName}""Create_ApplicationEnv_${_ApplicationName}_${_Environment}" 2&1 >/dev/null

if [ $? -eq 0 ] ; then

debug"blclicheckfor$JobPath/${_ApplicationName}Create_ApplicationEnv_${_ApplicationName}_${_Environment}succeeded"

blcli_storeenv CHECK_RESULT

if [ "x$CHECK_RESULT" = "xtrue" ] ; then

fatal"Theapplicationalreadyexists.Exiting"

fi

debug"blclicheckfor$JobPath/${_ApplicationName}Create_ApplicationEnv_${_ApplicationName}_${_Environment}succeededbutwasfalse"

fi

}

check_role ()

{

for ROLE in ${_BusinessAreaUser}p ${_BusinessAreaUser}d ${_BusinessAreaUser}u ; do

blcli_execute RBACRole getDBKeyByName ${ROLE}_ADMIN 2&1 >/dev/null

if [ $? -ne 0 ]; then

fatal"${ROLE}_ADMINalreadyexists,addingtheADgroupstothisrole...."

else

create_admin_role $ROLE

fi

done

for ROLE in ${_BusinessAreaUser}d ; do

ldap_SUPP_TEAM3$ROLE

ldap_SUPP_TEAM1$ROLE

ldap_SUPP_TEAM2$ROLE

done

for ROLE in ${_BusinessAreaUser}p ${_BusinessAreaUser}u ; do

ldap_SUPP_TEAM1$ROLE

ldap_SUPP_TEAM2$ROLE

done

}

create_admin_role ()

{

#########

#Creates the RBAC Role based on the _BusinessAreaUser

#########

AUTH_UNIX_USER=`echo $ROLE | tr '[:upper:]' '[:lower:]'`

AUTH_WINDOWS_USER="SPSAdmin"

blcli_execute RBACRole createRole ${ROLE}_ADMIN "RoleforUnixSWEBuser$ROLE" 8 $AUTH_UNIX_USER $AUTH_WINDOWS_USER

blcli_execute RBACRole addPermission "${ROLE}_ADMIN" RBACAdmins "Role.*"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""ComplianceAuditManagement.Analysis"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""ComplianceAuditManagement.Discovery"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""ComplianceAuditManagement.Remediation"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""ServerManagement"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""SoftwareManagement.Deployment"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""SoftwareManagement.Packaging"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""SoftwareManagement.Promotion"

blcli_execute RBACRole addAuthProfileToRoleByName "${ROLE}_ADMIN""WorkspaceManagement"

#create ACL template and apply to objects

echo"

${ROLE}_ADMIN_DEFAULT default_ACL_template_for_role_$ROLE"|grep-v^$|grep-v\#|whilereadARGS;do

blcli_execute BlAclTemplate createAclTemplate $ARGS

blcli_execute BlAclTemplate addPermission "${ROLE}_ADMIN_DEFAULT" RBACAdmins "ACLTemplate.*"

blcli_execute BlAclTemplate addTemplatePermissionProfile ${ROLE}_ADMIN_DEFAULT BLAdmins "PerformAllOperationsExceptSecurity"

blcli_execute BlAclTemplate addTemplatePermissionProfile ${ROLE}_ADMIN_DEFAULT APPAdmins"PerformAllOperationsExceptSecurity"

blcli_execute BlAclTemplate addTemplatePermissionProfile ${ROLE}_ADMIN_DEFAULT ${ROLE}_ADMIN "PerformAllOperationsExceptSecurity"

done

blcli_execute RBACRole setDefaultAclTemplateByName ${ROLE}_ADMIN ${ROLE}_ADMIN_DEFAULT

}

ldap_SUPP_TEAM3()

{

#########

#create the LDAP group query and sync

#########

blcli_execute Ldap showQuery ${_SUPP_TEAM3}_Group_Query

if [ $? = 0 ]; then

echo"\n${_SUPP_TEAM3}_Group_Queryalreadyexists...skipping"

else

blcli_execute Ldap createQuery "${_SUPP_TEAM3}_Group_Query""CN=${_SUPP_TEAM3},OU=Groups,OU=GLB,DC=INTRANET,DC=DOMAIN,DC=COM""(objectClass=group)""member""LDAPQuerytosyncusersfrom$ADGROUP"

blcli_execute Ldap addQueryPermission "${_SUPP_TEAM3}_Group_Query" RBACAdmins "LdapQuery.*"

blcli_execute RBACRole addLdapGroupMapping ${ROLE}_ADMIN $ldapConnectionName$automationPrincipalName"${_SUPP_TEAM3}_Group_Query"$userQueryName

#blcli_execute RBACRole addLdapGroupMapping ${ROLE}_ADMIN $ldapConnectionName $automationPrincipalName "${_JHUAdminADGroup}_Group_Query" $userQueryName

blcli_execute RBACRole setLdapSyncOptions ${ROLE}_ADMIN truefalsefalse

blcli_execute RBACRole syncUsers ${ROLE}_ADMIN

fi

}

ldap_SUPP_TEAM1()

{

#create the LDAP group query and sync

blcli_execute Ldap showQuery ${_SUPP_TEAM1}_Group_Query

if [ $? = 0 ]; then

echo"\n${_SUPP_TEAM1}_Group_Queryalreadyexists...skipping"

else

blcli_execute Ldap createQuery "${_SUPP_TEAM1}_Group_Query""CN=${_SUPP_TEAM1},OU=Groups,OU=GLB,DC=INTRANET,DC=DOMAIN,DC=COM""(objectClass=group)""member""LDAPQuerytosyncusersfrom$ADGROUP"

blcli_execute Ldap addQueryPermission "${_SUPP_TEAM1}_Group_Query" RBACAdmins "LdapQuery.*"

blcli_execute RBACRole addLdapGroupMapping ${ROLE}_ADMIN $ldapConnectionName$automationPrincipalName"${_SUPP_TEAM1}_Group_Query"$userQueryName

#blcli_execute RBACRole addLdapGroupMapping ${ROLE}_ADMIN $ldapConnectionName $automationPrincipalName "${_JHUAdminADGroup}_Group_Query" $userQueryName

blcli_execute RBACRole setLdapSyncOptions ${ROLE}_ADMIN truefalsefalse

blcli_execute RBACRole syncUsers ${ROLE}_ADMIN

fi

}

ldap_SUPP_TEAM2()

{

#create the LDAP group query and sync

blcli_execute Ldap showQuery ${_SUPP_TEAM2}_Group_Query

if [ $? = 0 ]; then

echo"\n${_SUPP_TEAM2}_Group_Queryalreadyexists...skipping"

else

blcli_execute Ldap createQuery "${_SUPP_TEAM2}_Group_Query""CN=${_SUPP_TEAM2},OU=Groups,OU=GLB,DC=INTRANET,DC=DOMAIN,DC=COM""(objectClass=group)""member""LDAPQuerytosyncusersfrom$ADGROUP"

blcli_execute Ldap addQueryPermission "${_SUPP_TEAM2}_Group_Query" RBACAdmins "LdapQuery.*"

blcli_execute RBACRole addLdapGroupMapping ${ROLE}_ADMIN $ldapConnectionName$automationPrincipalName"${_SUPP_TEAM2}_Group_Query"$userQueryName

#blcli_execute RBACRole addLdapGroupMapping ${ROLE}_ADMIN $ldapConnectionName $automationPrincipalName "${_JHUAdminADGroup}_Group_Query" $userQueryName

blcli_execute RBACRole setLdapSyncOptions ${ROLE}_ADMIN truefalsefalse

blcli_execute RBACRole syncUsers ${ROLE}_ADMIN

fi

}

#########

#Create the Job workspace

#########

create_workspace ()

{

JOB_GROUP="$JobPath/${_ApplicationName}"

blcli_execute JobGroup groupExists "${JOB_GROUP}" 2&1 >/dev/null

blcli_storeenv CHECK_RESULT

if [ "x$CHECK_RESULT" = "xfalse" ]; then

blcli_execute JobGroup createGroupWithParentName "${_ApplicationName}""$JobPath" 2&1 >/dev/null

if [ $? -ne 0 ]; then

fatal"ProblemCreatingtheJobGroupFolder: $err"

fi

blcli_storeenv JOBGROUP_ID

blcli_execute Group applyAclTemplate "${JOB_GROUP}" 5005 ${_BusinessAreaUser}p_ADMIN_DEFAULT false 2&1 >/dev/null

blcli_execute Group applyAclTemplate "${JOB_GROUP}" 5005 ${_BusinessAreaUser}u_ADMIN_DEFAULT false 2&1 >/dev/null

blcli_execute Group applyAclTemplate "${JOB_GROUP}" 5005 ${_BusinessAreaUser}d_ADMIN_DEFAULT false 2&1 >/dev/null

echo"Jobworkspace"${_ApplicationName}"created"

else

blcli_execute JobGroup groupNameToId "${JOB_GROUP}" 2&1 >/dev/null

blcli_storeenv JOBGROUP_ID

fi

#########

#Create the Depot workspace

#########

blcli_execute DepotGroup groupExists $DepotPath/${_ApplicationName} 2&1 >/dev/null

blcli_storeenv CHECK_RESULT

if [ "x$CHECK_RESULT" = "xfalse" ]; then

blcli_execute DepotGroup createGroupWithParentName ${_ApplicationName} $DepotPath

if [ $? -ne 0 ]; then

fatal"ProblemCreatingtheDepotGroupFolder: $err"

fi

blcli_storeenv DEPOTGROUP_ID

blcli_execute Group applyAclTemplate "$DepotPath/${_ApplicationName}" 5001 ${_BusinessAreaUser}p_ADMIN_DEFAULT false

blcli_execute Group applyAclTemplate "$DepotPath/${_ApplicationName}" 5001 ${_BusinessAreaUser}u_ADMIN_DEFAULT false

blcli_execute Group applyAclTemplate "$DepotPath/${_ApplicationName}" 5001 ${_BusinessAreaUser}d_ADMIN_DEFAULT false

echo"Depotworkspace"${_ApplicationName}"created"

#########

#Create the Component workspace

#########

blcli_execute SmartComponentGroup createGroup "$DevComponentGroup""${_ApplicationName}""DevSmartGroupfor${_ApplicationName}" TEMPLATE.NAME "equals" Application

if [ $? != 0 ]; then

echo"\nProblemCreatingtheComponentGroupFolder: $err"

blcli_disconnect

exit 1

fi

blcli_execute SmartComponentGroup addCondition "$DevComponentGroup/${_ApplicationName}" _JBOSS_ENV "equals" Development

blcli_execute SmartComponentGroup addCondition "$DevComponentGroup/${_ApplicationName}" _JBOSS_APPLICATION_NAME "equals""${_ApplicationName}"

blcli_execute SmartComponentGroup setMatchAll "$DevComponentGroup/${_ApplicationName}"true

blcli_execute Group applyAclTemplate "$DevComponentGroup/${_ApplicationName}" 5015 ${_BusinessAreaUser}d_ADMIN_DEFAULT false

blcli_execute SmartComponentGroup createGroup "$UatComponentGroup""${_ApplicationName}""UatSmartGroupfor${_ApplicationName}" TEMPLATE.NAME "equals" Application

blcli_execute SmartComponentGroup addCondition "$UatComponentGroup/${_ApplicationName}" _JBOSS_ENV "equals" UAT

blcli_execute SmartComponentGroup addCondition "$UatComponentGroup/${_ApplicationName}" _JBOSS_APPLICATION_NAME "equals""${_ApplicationName}"

blcli_execute SmartComponentGroup setMatchAll "$UatComponentGroup/${_ApplicationName}"true

blcli_execute Group applyAclTemplate "$UatComponentGroup/${_ApplicationName}" 5015 ${_BusinessAreaUser}u_ADMIN_DEFAULT false

blcli_execute SmartComponentGroup createGroup "$ProdComponentGroup""${_ApplicationName}""ProdSmartGroupfor${_ApplicationName}" TEMPLATE.NAME "equals" Application

blcli_execute SmartComponentGroup addCondition "$ProdComponentGroup/${_ApplicationName}" _JBOSS_ENV "equals" Production

blcli_execute SmartComponentGroup addCondition "$ProdComponentGroup/${_ApplicationName}" _JBOSS_APPLICATION_NAME "equals""${_ApplicationName}"

blcli_execute SmartComponentGroup setMatchAll "$ProdComponentGroup/${_ApplicationName}"true

blcli_execute Group applyAclTemplate "$ProdComponentGroup/${_ApplicationName}" 5015 ${_BusinessAreaUser}p_ADMIN_DEFAULT false

else

blcli_execute DepotGroup groupNameToId $DepotPath/${_ApplicationName}

blcli_storeenv DEPOTGROUP_ID

fi

}

run_sql_storedprocedure ()

{

COMMAND=$(cat < EOF

exec [INTRANET\\whiterob].[TEST_JBOSS_COMMISSION_APP_ENV]

@APPLICATION_NAME="${_ApplicationName}",

@SUPP_TEAM2="${_SUPP_TEAM2}",

@SUPP_TEAM3="${_SUPP_TEAM3}",

@SUPP_TEAM1="${_SUPP_TEAM1}",

@PRIMARY_SERVICE="${_PrimaryService}",

@GROUP_DISTRIBUTION_LIST="${_GroupDistroList}",

@INITIATOR="${_Initiator}",

@CDR="${_Cdr}",

@CR="${_Cr}",

@PROJECT_NAME="${_ProjectName}",

@PROJECT_DESCRIPTION="${_ProjectDiscription}",

@ENVIRONMENT="${_Environment}",

@JBOSS_USER="${_JBossUser}",

@JBOSS_VERSION="${_JBossVersion}",

@JAVA_HOME="${_JavaHome}",

@CLUSTER_ENABLED="${_JBossClusteringEnabled}",

@CLUSTER_NAME="${_JBossClusterName}",

@CLUSTER_MEMBERS="${_JBossClusterMembers}",

@XMS=${_JavaXMS},

@XMX=${_JavaXMX},

@FARM_GROUP_NAME="jboss-ldn",

@DEBUG="true"

EOF

)

echo -e "$COMMAND\ngo" | /apps/dbeng_build/freetds/version/0.82-3/bin/tsql -o fh -H LDNDCM05673V05A -p 10501 -U sysbwaggui -P pa55word -D bWAGConsoleDev 1>- 2> $TMP_FILE

_JBossBasePort=$(grep -e "Base Port .*" $TMP_FILE | cut -c 21-24)

if [ -z "${_JBossBasePort}" ] ; then

fatal"Baseportnotreturnedfromdatabase"

fi

debug"BasePortis${_JBossBasePort}"

if [ ${_JBossClusteringEnabled}="true" -a ${_Environment} != "development" ] ; then

_JBossClusterMulticastPort=$(grep -e "Multicast Port .*" $TMP_FILE | cut -c 21-24 )

_JBossClusterMulticastAddress=$(grep -e "Multicast Address .*" $TMP_FILE | cut -c 21-36 | sed 's/ //g')

if [ -z "${_JBossClusterMulticastPort}" ] ; then

fatal"Multicastporthasnotreturnedfromdatabase"

fi

if [ -z "${_JBossClusterMulticastAddress}" ] ; then

fatal"Multicastaddresshasnotreturnedfromdatabase"

fi

debug"MulticastPortis${_JBossClusterMulticastPort}"

debug"MulticastAddressis${_JBossClusterMulticastAddress}"

fi

rm -f $TMP_FILE

}

create_repo_space ()

{

# Create the directory and assign AD Groups to repository (for application deployment)

cd //$RepoServer$RepoPath

mkdir ${_ApplicationName}_${_Environment}

nexec -e icacls ./${_ApplicationName}_${_Environment} /inheritance:d

nexec -e icacls ./${_ApplicationName}_${_Environment} /remove:g Everyone

nexec -e icacls ./${_ApplicationName}_${_Environment} /grant "fLDNwebengineering:(OI)(CI)F"

nexec -e icacls ./${_ApplicationName}_${_Environment} /grant "${_SUPP_TEAM3}:(OI)(CI)F"

nexec -e icacls ./${_ApplicationName}_${_Environment} /grant "${_SUPP_TEAM2}:(OI)(CI)F"

cd //@

}

create_property_class ()

{

}

#########

# Create the NSHScript Job to create Environment from existing Depot NSH Scripts

#########

create_jobs()

{

JOB_GROUP="$JobPath/${_ApplicationName}"

JOB_NAME="Create_ApplicationEnv_${_ApplicationName}_${_Environment}"

blcli_execute NSHScriptJob createNSHScriptJob "${JOB_GROUP}""${JOB_NAME}""ExecuteInstanceCreationscript""$NshScriptPath""$NshScriptName"aserver.intranet.DOMAIN.com 40 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletocreatetheNSHScriptJob: $err"

fi

blcli_storeenv SCRIPTJOB1_ID

blcli_execute Job clearTargetServers $SCRIPTJOB1_ID 2&1 >/dev/null

blcli_storeenv SCRIPTJOB1_ID

if [ ${_Environment} = development ] ; then

blcli_execute Job applyAclTemplate $SCRIPTJOB1_ID ${_BusinessAreaUser}d_ADMIN_DEFAULT false 2&1 >/dev/null

blcli_storeenv SCRIPTJOB1_ID

fi

if [ ${_Environment} = production ] ; then

blcli_execute Job applyAclTemplate $SCRIPTJOB1_ID ${_BusinessAreaUser}p_ADMIN_DEFAULT false 2&1 >/dev/null

blcli_storeenv SCRIPTJOB1_ID

fi

if [ ${_Environment} = uat ] ; then

blcli_execute Job applyAclTemplate $SCRIPTJOB1_ID ${_BusinessAreaUser}u_ADMIN_DEFAULT false 2&1 >/dev/null

blcli_storeenv SCRIPTJOB1_ID

fi

blcli_execute NSHScriptJob clearNSHScriptParameterValuesByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 2&1 >/dev/null

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 0 $_SUPP_TEAM3 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_SUPP_TEAM3 : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 1 $_SUPP_TEAM1 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_SUPP_TEAM1 : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 2 $_Environment 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_Environment : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 3 $_JavaHome 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JavaHome : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 4 $_JavaXMS 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JavaXMS : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 5 $_JavaXMX 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JavaXMX : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 6 $_JBossClusteringEnabled 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossClusteringEnabled : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 7 $_JBossClusterMembers 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossClusterMembers : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 8 $_JBossClusterMulticastAddress 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossClusterMulticastAddress : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 9 $_JBossClusterMulticastPort 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossClusterMulticastPort : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 10 $_JBossUser 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossUser : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 11 $_JBossVersion 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossVersion : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 12 $_ApplicationName 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_ApplicationName : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 13 $_SUPP_TEAM2 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_SUPP_TEAM2 : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 14 $_JBossClusterName 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossClusterName : $err"

fi

blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "${JOB_GROUP}""${JOB_NAME}" 15 $_JBossBasePort 2&1 >/dev/null

if [ $? -ne 0 ]

then

fatal"\nUnabletosettheproperty_JBossBasePort : $err"

fi

echo"JobCreate_ApplicationEnv_${_ApplicationName}_${_Environment}created"

echo""

echo"\nScriptJob"$JobPath/${_ApplicationName}/Create_ApplicationEnv_${_ApplicationName}_${_Environment}"hasbeencreated"

#########

#Create ChangeSystem.sh Deploy Job

#########

blcli_execute BlPackage getDBKeyByGroupAndName $CommonDepotPath$BlPackageName1

if [ $? != 0 ]

then

fatal"\nUnabletofindinstanceBLPackage: $err"

fi

blcli_storeenv BLPACKAGE1_ID

blcli_execute DeployJob createDeployJob "ChangeSystem.sh_${_ApplicationName}_${_Environment}"$JOBGROUP_ID $BLPACKAGE1_ID aserver.intranet.DOMAIN.com falsetruefalse 2&1 >/dev/null

if [ $? != 0 ]

then

fatal"\nUnabletocreatetheDeployJob: $err"

fi

blcli_storeenv DEPLOYJOB1_ID

blcli_execute Job clearTargetServers $DEPLOYJOB1_ID

blcli_storeenv DEPLOYJOB1_ID

if [ ${_Environment} = development ] ; then

blcli_execute Job applyAclTemplate $DEPLOYJOB1_ID ${_BusinessAreaUser}d_ADMIN_DEFAULT false

blcli_storeenv DEPLOYJOB1_ID

fi

if [ ${_Environment} = production ] ; then

blcli_execute Job applyAclTemplate $DEPLOYJOB1_ID ${_BusinessAreaUser}p_ADMIN_DEFAULT false

blcli_storeenv DEPLOYJOB1_ID

fi

if [ ${_Environment} = uat ] ; then

blcli_execute Job applyAclTemplate $DEPLOYJOB1_ID ${_BusinessAreaUser}u_ADMIN_DEFAULT false

blcli_storeenv DEPLOYJOB1_ID

fi

echo"JobChangeSystem.sh_${_ApplicationName}_${_Environment}created"

#########

#Create StartStopThreads Deploy Job

#########

blcli_execute BlPackage getDBKeyByGroupAndName $CommonDepotPath$BlPackageName2

if [ $? != 0 ]

then

fatal"\nUnabletofindinstanceBLPackage: $err"

fi

blcli_storeenv BLPACKAGE2_ID

blcli_execute DeployJob createDeployJob "StartStopThreads_${_ApplicationName}_${_Environment}"$JOBGROUP_ID $BLPACKAGE2_ID aserver.intranet.DOMAIN.com falsetruefalse 2&1 >/dev/null

if [ $? != 0 ]

then

fatal"\nUnabletocreatetheDeployJob: $err"

fi

blcli_storeenv DEPLOYJOB2_ID

blcli_execute Job clearTargetServers $DEPLOYJOB2_ID

blcli_storeenv DEPLOYJOB2_ID

if [ ${_Environment} = development ] ; then

blcli_execute Job applyAclTemplate $DEPLOYJOB2_ID ${_BusinessAreaUser}d_ADMIN_DEFAULT false

blcli_storeenv DEPLOYJOB2_ID

fi

if [ ${_Environment} = production ] ; then

blcli_execute Job applyAclTemplate $DEPLOYJOB2_ID ${_BusinessAreaUser}p_ADMIN_DEFAULT false

blcli_storeenv DEPLOYJOB2_ID

fi

if [ ${_Environment} = uat ] ; then

blcli_execute Job applyAclTemplate $DEPLOYJOB2_ID ${_BusinessAreaUser}u_ADMIN_DEFAULT false

blcli_storeenv DEPLOYJOB2_ID

fi

echo"StartStopThreads_${_ApplicationName}_${_Environment}created"

echo"\nPleaseruntheinstanceDeploymentscripttoassigntargetsandexecutethedeployment"

echo""

}

#########

# MAIN SCRIPT

#########

run_sql_storedprocedure

check_already_exists

check_role

create_workspace

create_repo_space

create_property_class

create_jobs

Script to Provision a Commissioned JBoss environment (as JHUAadmins)

  • Takes the Application Name, Environment and a Server “Deployment Group” name as input
  • Executes the JBossInstanceDeployment script after passing a target group to the job.

#!/bin/nsh

#######################################################################

#Script to execute JBoss instance provision once Commission phase complete

#

#Scott Dunbar 23/05/12

#Version 1.0

#######################################################################

#set -eE

#set x

usage() {

echo"Usage:$0<target<environment[development|uat|production}<appname>"

exit

}

fatal() {

echo $*

blcli_disconnect

exit 1

}

if [ $# -ne 3 -a $# -ne 5 ] ; then

usage

fi

TARGET=$1

ENVIRONMENT=$2

APPNAME=$3

JobPath="/JBoss/ApplicationManagement"

ENVIRONMENT_NOCASE=`echo $ENVIRONMENT | tr '[:upper:]' '[:lower:]'`

case ${ENVIRONMENT_NOCASE} in

production )DeploymentGroup="/Production/ApplicationDeployment"

;;

uat ) DeploymentGroup="/UAT/ApplicationDeployment"

;;

development )DeploymentGroup="/Development/ApplicationDeployment"

;;

* ) usage

;;

esac

JOB_NAME="Create_ApplicationEnv_${APPNAME}_${ENVIRONMENT}"

blcli_setoption serviceProfileName DEV

blcli_setoption roleName APPAdmins

blcli_connect

if [ $? -ne 0 ] ; then

if [ -n "$5" ] ; then

blcred cred -acquire -profile DEV -username "$4" -password "$5"

else

blcred cred -acquire -profile DEV

fi

fi

blcli_execute NSHScriptJob getDBKeyByGroupAndName $JobPath/$APPNAME"${JOB_NAME}"

if [ $? -ne 0 ]

then

fatal"CannotfindtheNSHScriptJobSpecified:${JOB_NAME}: $err"

fi

blcli_storeenv SCRIPTJOBRUN1_ID

blcli_execute Job addTargetGroup $SCRIPTJOBRUN1_ID "$DeploymentGroup/$TARGET"

if [ $? -ne 0 ]

then

fatal"TargetServerGroup$TARGETcoundnotbefoundandwasnotaddedto${JOB_NAME}: $err"

else

echo"TargetServerGroup$TARGETaddedto${JOB_NAME}"

blcli_storeenv SCRIPTJOBRUN1_ID

fi

blcli_execute NSHScriptJob executeJobAndWait $SCRIPTJOBRUN1_ID

if [ $? -ne 0 ]

then

fatal"Problemexecutingthedeployjob : $err"

fi

#Execute the Job

blcli_execute NSHScriptJob getDBKeyByGroupAndName $JobPath/$APPNAME"${JOB_NAME}"

if [ $? -ne 0 ]

then

fatal"ScriptJobcouldnotbefound${JOB_NAME}: $err"

else

blcli_storeenv SCRIPTJOBRUN1_ID

fi

blcli_execute JobRun findLastRunKeyByJobKey $SCRIPTJOBRUN1_ID

blcli_storeenv RUNKEY

blcli_execute JobRun getJobRunHadErrors $RUNKEY

blcli_storeenv RESULT

blcli_execute JobRun jobRunKeyToJobRunId $RUNKEY

blcli_storeenv JOBID

DATE=`date +%d%m%Y-%H%M%s`

blcli_execute Utility exportNSHScriptRun $JOBID$0_${DATE}.$$.csv

echo"TheScriptJobencounteredanerror=$RESULT"

Script to deploy an application payload to all instances of an environment (as a Developer user)

/Depot/Sandbox/Scott/ NonUI_applicationDeployment

  • Takes and application name and environment as input (assumes application payload is already in the correct location)
  • Adds a specified payload to a BLPackage
  • Creates a Deploy Job for that Package
  • Adds the appropriate environment Component Smart Group as the target for the Deploy Job
  • Executes the deploy job

#!/nsh

#######################################################################

#Script to execute deploy job of JBoss install binaries

#

#Scott Dunbar 28/05/12

#Version 1.0

#######################################################################

#set -eE

set -x

# ONLY NEEDED IF RUNNING OUTSIDE OF THE GUI

#blcred cred -acquire -profile DEV -username RBACAdmin -password password

blcli_setoption serviceProfileName DEV

#blcli_setoption roleName #should be set by NSH Proxy

blcli_connect

#Process

# 1.

#######################################################################

# Set some expected paramerters

#######################################################################

#SOURCEHOST=`fqdn`

#HOSTNAME=`print $HOSTNAME|tr '[ ]' '[]'`

#echo "The target is [${HOSTNAME}]"

#FILE_PATH=$1#the source files for the job. Must be in NSH format

APPNAME=$1

ENVIRONMENT=$2

EXPECTED_ARGS=2

if [ $# -ne $EXPECTED_ARGS ]

then

echo"Usage:`basename $0`<ApplicationName<Environment[development|uat|production]>"

blcli_disconnect

exit 1

fi

DATE=`date +%d%m%Y-%H%M`

JobName="Deploy_AppFiles_${APPNAME}_${ENVIRONMENT}_$DATE"

PackageName="${APPNAME}_${ENVIRONMENT}_Payload_$DATE"

JobGroup=/JBoss/ApplicationManagement

DeployFolderPath=/apps/middleware/applications/jboss-as/content/$APPNAME

Template=DeployApplication

TemplateGroup=/JBoss/Common

RepoServer=aserver.adomain.com

RepoPath=/c/JAH

ENVIRONMENT=`echo $ENVIRONMENT | tr '[:upper:]' '[:lower:]'`

case${ENVIRONMENT}in

production )ComponentGroup="/JBoss/Application/Production"

;;

uat ) ComponentGroup="/JBoss/Application/UAT"

;;

development )ComponentGroup="/JBoss/Application/Development"

;;

* ) usage

;;

esac

create_package ()

{

blcli_execute DepotGroup groupExists $JobGroup/$APPNAME

blcli_storeenv CHECK_RESULT

if [ $CHECK_RESULT = false ]; then

echo"\nItlooksliketheApplicationEnviornment$APPNAMEhasnotbeencommissionedyet.Stoppingscript"

blcli_disconnect

exit 1

else

blcli_execute DepotGroup groupNameToId $JobGroup/$APPNAME

blcli_storeenv DEPOTGROUP_ID

fi

blcli_execute Template setLocalParameterDefaultValue $Template$TemplateGroup _SourcePayload "$RepoPath/${APPNAME}_${ENVIRONMENT}"

if [ $? != 0 ]

then

echo"\nUnabletosetthe_SourcePayloadproperty"

blcli_disconnect

exit 1

fi

blcli_execute Template getDBKeyByGroupAndName $TemplateGroup$Template

if [ $? != 0 ]

then

echo"\nUnabletofindthetemplatespecified"

blcli_disconnect

exit 1

fi

blcli_storeenv TEMPLATE_DBKEY

blcli_execute BlPackage createPackageFromAsset "$PackageName"$DEPOTGROUP_ID falsefalsefalsetruefalse$TEMPLATE_DBKEY $RepoServer

if [ $? != 0 ]

then

echo"\nUnabletocreateaBLPackageofyourpayload. Pleasecheckthesourceandtryagain"

blcli_disconnect

exit 1

fi

blcli_storeenv BLPACKAGE_ID

echo"rm-rf??_SourcePayload??/*" > /tmp/ExCmdStart.txt

echo"find??_SourcePayload??-typef-execchmodg+r{}\;" > /tmp/ExCmdEnd.txt

echo"n/a" > /tmp/UndoCmd.txt

blcli_execute BlPackage addExternalCmdToStart $BLPACKAGE_ID "Clear$APPNAMEDirectory" /tmp/ExCmdStart.txt /tmp/UndoCmd.txt "Abort"

if [ $? != 0 ]

then

echo"\nWarning: Couldnotclearthecontentsofdirectory"

fi

blcli_execute BlPackage addExternalCmdToEnd $BLPACKAGE_ID "Chmodoffiles" /tmp/ExCmdEnd.txt /tmp/UndoCmd.txt "Abort"

if [ $? != 0 ]

then

echo"\nWarning: Thepermissionsofthepayloadcouldnotbechanged"

fi

rm /tmp/ExCmdStart.txt

rm /tmp/ExCmdEnd.txt

rm /tmp/UndoCmd.txt

}

create_deploy_job ()

{

blcli_execute JobGroup groupNameToId $JobGroup/$APPNAME

blcli_storeenv JOBGROUP_ID

blcli_execute DeployJob createDeployJob "$JobName"$JOBGROUP_ID $BLPACKAGE_ID aserver.intranet.DOMAIN.com falsetruefalse

if [ $? != 0 ]

then

echo"\nUnabletocreatetheDeployJob: $err"

blcli_disconnect

exit 1

fi

blcli_storeenv DEPLOYJOB1_ID

blcli_execute Job clearTargetServers $DEPLOYJOB1_ID

blcli_storeenv DEPLOYJOB1_ID

blcli_execute Job addTargetComponentGroup $DEPLOYJOB1_ID "$ComponentGroup/$APPNAME"

if [ $? != 0 ]

then

echo"\nCouldnotfindatargetComponentSmartGroupbyname$APPNAMEandEnvironment$ENVIRONMENT: $err"

blcli_disconnect

exit 1

fi

#blcli_execute Job addTargetServer $DEPLOYJOB1_ID nykpsr0161.intranet.DOMAIN.com

blcli_storeenv DEPLOYJOB1_ID

#change the payload path to new destination

blcli_execute DeployJob setOverriddenParameterValue "$JobGroup/$APPNAME""$JobName" _SourcePayload $DeployFolderPath

if [ $? != 0 ]

then

echo"\nUnabletosetthe_SourcePayloadproperty"

blcli_disconnect

exit 1

fi

}

execute_job ()

{

blcli_execute DeployJob executeJobAndWait $DEPLOYJOB1_ID

if [ $? != 0 ]

then

echo"\nProblemexecutingtheDeployJob: $err"

blcli_disconnect

exit 1

else

echo"\nJobExecuted"

fi

blcli_execute DeployJob getDBKeyByGroupAndName $JobGroup/$APPNAME"$JobName"

if [ $? != 0 ]

then

echo"\nTargetServerGroupcoundnotbefound: $err"

blcli_disconnect

exit 1

fi

blcli_storeenv DEPLOYJOB1_ID

blcli_execute JobRun findLastRunKeyByJobKey $DEPLOYJOB1_ID

blcli_storeenv RUNKEY

blcli_execute JobRun getJobRunHadErrors $RUNKEY

blcli_storeenv RESULT

blcli_execute DeployJobRun findLastRunIdByJobKey $DEPLOYJOB1_ID

blcli_storeenv JOBKEY

blcli_execute Utility exportDeployRun $JobGroup/$APPNAME"$JobName"$JOBKEY$0_${DATE}.$$.csv

echo"TheDeployJobencounteredanerror=$RESULT"

}

#

#MAIN SCRIPT

#

create_package

create_deploy_job

execute_job

Script to start, stop or thread dump all JBoss instances of an environment (as a Developer user)

/Depot/Sandbox/Scott/ NonUI_JBossInstanceStartStopThreads

  • Takes Application Name, Environment and desired action as input.
  • Adds Component Smart Group target based on Environment and Application Name logic
  • Creates a deploy job from an existing BLPackage that contains the external commads for start, stop or threads of the jbctrl.sh script
  • Pass required parameters to JBossInstanceStartStopThreads BLPackage deploy job
  • Executes the updated JBossInstanceStartStopThreads script.

#!/bin/nsh

#######################################################################

#Script to execute deploy job of JBoss install binaries

#

#Scott Dunbar 06/06/12

#Version 1.0

#######################################################################

#set -eE

set -x

# ONLY NEEDED IF RUNNING OUTSIDE OF THE GUI

#blcred cred -acquire -profile DEV -username RBACAdmin -password password

blcli_setoption serviceProfileName DEV

blcli_connect

#Process

# 1. C

#######################################################################

# Set some expected paramerters

#######################################################################

#TARGET=`fqdn`

#TARGET=`print $TARGET|tr '[ ]' '[]'`

#echo "The target is [${TARGET}]"

APPNAME=$1

ENVIRONMENT=$2

ACTION=$3

EXPECTED_ARGS=3

if [ $# -ne $EXPECTED_ARGS ]

then

echo"Usage:`basename $0`<ApplicationName<Environment<start/stop/threads>"

blcli_disconnect

exit 1

fi

ENVIRONMENT=`echo $ENVIRONMENT | tr '[:upper:]' '[:lower:]'`

JobGroup=/JBoss/ApplicationManagement

DeployFolderPath=/apps/middleware/applications/jboss-as/content/$APPNAME

ProdComponentGroup="/JBoss/Application/Production"

DevComponentGroup="/JBoss/Application/Development"

UatComponentGroup="/JBoss/Application/UAT"

if [ ${ENVIRONMENT} = production ] ; then

ComponentGroup=$ProdComponentGroup

fi

if [ ${ENVIRONMENT} = development ] ; then

ComponentGroup=$DevComponentGroup

fi

if [ ${ENVIRONMENT} = uat ] ; then

ComponentGroup=$UatComponentGroup

fi

blcli_execute DeployJob getDBKeyByGroupAndName $JobGroup/$APPNAME"StartStopThreads_${APPNAME}_${ENVIRONMENT}"

if [ $? != 0 ]

then

echo"\nCannotfindtheDeployJobSpecifiedStartStopThreads_${APPNAME}_${ENVIRONMENT} : $err"

blcli_disconnect

exit 1

fi

blcli_storeenv DEPLOYJOB1_ID

blcli_execute Job clearTargetServers $DEPLOYJOB1_ID

blcli_execute Job addTargetComponentGroup $DEPLOYJOB1_ID "$ComponentGroup/$APPNAME"

if [ $? != 0 ]

then

echo"\nTargetServerGroupcoundnotbefoundandwasnotaddedtoStartStopThreads_${APPNAME}_${ENVIRONMENT} : $err"

blcli_disconnect

exit 1

else

echo"\nTargetServerGroupaddedtoStartStopThreads_${APPNAME}_${ENVIRONMENT}"

blcli_storeenv DEPLOYJOB1_ID

fi

#Set DeployJob Values

blcli_execute DeployJob setOverriddenParameterValue "$JobGroup/$APPNAME""StartStopThreads_${APPNAME}_${ENVIRONMENT}" _Action $ACTION

if [ $? != 0 ]

then

echo"\nUnabletosetthe_SourcePayloadproperty"

blcli_disconnect

exit 1

fi

blcli_execute DeployJob setOverriddenParameterValue "$JobGroup/$APPNAME""StartStopThreads_${APPNAME}_${ENVIRONMENT}" _ApplicationName $APPNAME

if [ $? != 0 ]

then

echo"\nUnabletosetthe_SourcePayloadproperty"

blcli_disconnect

exit 1

fi

blcli_execute DeployJob setOverriddenParameterValue "$JobGroup/$APPNAME""StartStopThreads_${APPNAME}_${ENVIRONMENT}" _Environment $ENVIRONMENT

if [ $? != 0 ]

then

echo"\nUnabletosetthe_SourcePayloadproperty"

blcli_disconnect

exit 1

fi

#Execute the Job

blcli_execute DeployJob executeJobAndWait $DEPLOYJOB1_ID

if [ $? != 0 ]

then

echo"\nProblemexecutingthedeployjob : $err"

blcli_disconnect

exit 1

fi

blcli_execute DeployJob getDBKeyByGroupAndName $JobGroup/$APPNAME"StartStopThreads_${APPNAME}_${ENVIRONMENT}"

if [ $? != 0 ]

then

echo"\nScriptJobcoundnotbefoundStartStopThreads_${APPNAME}_${ENVIRONMENT} : $err"

blcli_disconnect

exit 1

else

blcli_storeenv DEPLOYJOB1_ID

fi

blcli_execute JobRun findLastRunKeyByJobKey $DEPLOYJOB1_ID

blcli_storeenv RUNKEY

blcli_execute DeployJobRun findLastRunIdByJobKey $DEPLOYJOB1_ID

blcli_storeenv JOBKEY

blcli_execute JobRun getJobRunHadErrors $RUNKEY

blcli_storeenv RESULT

DATE=`date +%d%m%Y-%H%M%s`

blcli_execute Utility exportDeployRun $JobGroup/$APPNAME"StartStopThreads_${APPNAME}_${ENVIRONMENT}"$JOBKEY ./$0_${DATE}.$$.csv

echo"TheScriptJobencounteredanerror=$RESULT"

/Depot/JBoss/Common/JBossInstanceDeployment

  • Called from NonUI_instanceCommission and executed by NonUI_executeInstanceDeploymentNSHScript
  • Creates components for Instance and Application
  • Sets correct ACL Template
  • Executes jboss-utils/bin/new-jboss-instance.sh script passing all parameters from instanceCommission properties file

#!bin/nsh