My Services WebSphere Training | JEE Build & Deploy | Automatic Linux Provisioning
################################################################################################### # # 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
Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.
Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.
Follow Steve as @stevencrobinson on twitter.
IBM WebSphere Application Server 8.0 Administration Guide
WebSphere Application Server 7.0 Administration Guide