Date Created: Thu 07-Feb-2008

Related Document Categories:

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


Using JACL to start a WebSphere Application.

This script is designed to work with WebSphere ND and starts an application in a names cluster in a given cell.

start_application.jacl

#------------------------------------------------------------------------------------------
# This script starts application installed on cluster.
# Pass application name, cluster name and cell name as command line argument to this script in the given sequence.
# Usage: wsadmin.sh -f ccs_start_application.jacl applicationName clusterName cellName
#------------------------------------------------------------------------------------------

if {$argc == 3} {
#set appname [$props getProperty ear.name]
#set clusterName [$props getProperty sib.cluster.name]
#set cell [$ccs_props getProperty was_cell]

set appname [lindex $argv 0]
set clusterName [lindex $argv 1]
set cell [lindex $argv 2]

set clusterId [$AdminConfig getid /ServerCluster:$clusterName/]
if {[llength $clusterId] == 1} {
puts "Cluster '$clusterName' exists."
set clusterMembers [$AdminConfig list ClusterMember $clusterId]
set installedApps [$AdminApp list]

# Check if application is installed
set applicationFound 0

foreach appId $installedApps {
set existingApp $appId
if {[string compare $appname $existingApp] == 0} {
set applicationFound 1
break
}
}

if {$applicationFound == 1} {
puts "Application $appname on cluster $clusterName found."
# Start the application if it is installed
puts "-------------------------"
puts "Starting the application: $appname on cluster $clusterName"
puts "-------------------------"
foreach m_id $clusterMembers {
set currentServer [$AdminConfig showAttribute $m_id memberName]
set currentNodeName [$AdminConfig showAttribute $m_id nodeName]
set query cell=$cell,node=$currentNodeName,type=ApplicationManager,process=$currentServer,*
set appManager [$AdminControl queryNames $query]
puts "Starting $appname on node $currentNodeName, server $currentServer."
$AdminControl invoke $appManager startApplication $appname
}
} else {
puts "-------------------------"
puts "Application: $appname on cluster $clusterName not found"
puts "-------------------------"
}
} else {
puts "Cluster '$clusterName' doesnot exist."
}
} else {
puts "Please supply application name, cluster name and cell name as command line argument."
puts "Usage: wsadmin.sh -f ccs_start_application.jacl applicationName clusterName cellName"
}

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


  • Linked In
  • Twitter
  • About Me
  • My Blog
  • Contact Me

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories