App_Install.jacl
proc uninstallApp {appName} { global AdminControl global AdminConfig global AdminApp ### Kludge - fix later... #set xappname [$AdminApp view $appName] # if {[llength $xappname] == 0} { # puts "App $xappname not found..." # } else { puts "Uninstall application - $appName" $AdminApp uninstall $appName $AdminConfig save # } } proc appinstall {cellName clusterName earFile appName} { global AdminApp global AdminControl global AdminConfig puts "Params: $cellName $clusterName $earFile $appName" ### ### Do some sanity checking ### - Do we have a clusterName by this name? ### set cname [$AdminControl getCell] set earfile $earFile puts "earfile: $earFile" set nameopt [list -appname $appName] append opts " " $nameopt lappend opts -cluster $clusterName lappend opts -preCompileJSPs puts " " puts "Installing $earfile using $opts" $AdminApp install $earfile $opts $AdminConfig save ### ### For each node, invoke a sync if necessary ### ### -- Is a nodeSync MBean available on this node? ### ### -- Find out if serverStartupSyncEnabled is true for this node ### If this attribute is set to "false" we have to perform a sync. ### If we do not, the node we are installing on may have an out-of-date ### copy of the config data. ### set cells [$AdminConfig list Cell] foreach cell $cells { set cname [$AdminConfig showAttribute $cell name] set nodes [$AdminConfig list Node $cell] puts " " puts "Cell: $cname" foreach node $nodes { set nodeName [lindex [lindex [$AdminConfig show $node {name}] 0] 1] puts $nodeName if {($nodeName == "host2CellManager01")} { puts "node = $node" continue } puts "Checking for the existence of a NodeSync MBean on node $nodeName" set sync1 [$AdminControl completeObjectName type=NodeSync,node=$nodeName,* ] if {[llength $sync1] == 0} { puts "NodeSync MBean not found for name $nodeName" break } puts "NodeSync MBean found for name $nodeName" set enabled [$AdminControl getAttribute $sync1 serverStartupSyncEnabled] if {[string compare $enabled "false"] == 0} { puts "Invoking synchronization for node $sync1 because serverStartupSyn cEnabled is set to false..." $AdminControl invoke $sync1 sync puts "Done with synchronization." } } } } ### ###Main ### ### Cellname: Cell01 ### ### if { !($argc == 4) } { puts "" puts "Usage: " puts " " puts "wsadmin.sh -f App_Install.jacl cellName clusterName earFile appName" } else { set cellName [lindex $argv 0] set clusterName [lindex $argv 1] set earFile [lindex $argv 2] set appName [lindex $argv 3] ## First, try to uninstall the appliction uninstallApp $appName ## Second, install the appliction appinstall $cellName $clusterName $earFile $appName }