Date Created: Fri 30-Nov-2007

Related Document Categories:

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



Partially completed template for building a menu driven JACL script


###################################################################################################
#
# Main Menu
# This is the first menu that the user will see when they first start the script
# Option 1 shows the status of all clusters in the cell
# Option 2 is used to start cluster by user input
# Option 3 i used to stop cluster by user input
#
###################################################################################################

proc mainMenu {} {

set loop true
puts stdout "\n\n\tWelcome to WebSphere Application Server Cluster Configuration Center"
puts stdout "================================================================================"
while {$loop} {
puts stdout "Please enter your choice from the following menu:"
puts stdout "\n 1) Show cluster status"
puts stdout "\n 2) Stop cluster"
puts stdout "\n 3) start cluster"
puts stdout "\n x) Exit (no save)"

puts stdout "\nYour Choice:"
set mainChoice [gets stdin]

switch -exact -- $mainChoice {
1 { clusterStatus }
#2 { clusterStop }
#3 { clusterStart }
x { set loop false; exit }
}
}
}


######################################################################################################
#
# Security Configuration Menu
# This menu show different parts of security component that can be configurated
#
######################################################################################################

###################################################################################################
proc clusterStatus {} {
global AdminConfig
global AdminControl

set cellName [$AdminControl getCell]
#puts "cell name: $cellName"

set clusters [$AdminConfig list ServerCluster]
#puts " Number of ServerClusters in $cellName: [llength $clusters]"

set loop true
puts stdout "\t----------------- Cluster Status Routine -------------------"
#puts stdout "================================================================================"
while {$loop} {
set i 0
foreach cluster $clusters {
#set arr(index) value
set clname [$AdminConfig showAttribute $cluster name]
set arr($i) $clname
#puts $arr($i)
incr i
}

#loop through array, could have done this above, but good example of how to loop an array
for {set i 1} {$i < [array size arr]} {incr i 1} {
puts "\n $i) $arr($i)"
}
puts stdout "\n x) Back to Main Menu"

set subChoice [gets stdin]


if {$subChoice == x} {
set loop false; break
} else {

#puts "$arr($subChoice)"
#puts ""
set clname $arr($subChoice)
set clusterObject [$AdminControl completeObjectName type=Cluster,name=$clname,*]
set status [$AdminControl getAttribute $clusterObject state]
puts "cluster $clname: $status"
puts ""
}
#end loop
}










}
###################################################################################################
#ENTRY POINT
###################################################################################################
mainMenu

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 leading brands around the world. Steve specialises in JEE, DevOps and Thought Leadership.

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


  • Linked In
  • Twitter
  • About Me
  • 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

Courses

  • WebSphere Courses

Articles

WebSphere Categories

Other Categories