###   
### set_HEAPDUMP.jacl   
###   
###   
###   
###   
###   
   
proc set_HEAPDUMP {cname nname sname} {   
   
   
###   
### set up globals   
###   
   
global AdminConfig   
global AdminControl   
global AdminApp   
   
set serverid [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/]   
   
if {[llength $serverid] == 0} {   
    puts "Serverid null - returning "   
    exit    
}   
   

###    
### Identify the JVM id belonging to the server and configure JVM...
###    
   
#set jvm [$AdminConfig list JavaVirtualMachine $serverid]
#$AdminConfig modify $jvm  [list  [list verboseModeGarbageCollection false ] ]



   
###    
### Configure Process Definition Environment
###    

set pdef [$AdminConfig list ProcessDef $serverid]
puts "Process Definition (ProcessDef): $pdef"

set name [list name IBM_HEAPDUMPDIR]
set rpAttrs [list $name]

$AdminConfig create environment $pdef $rpAttrs

set ps [$AdminConfig showAttribute $pdef environment]
puts "Property Set: $ps"

foreach p $ps {
   if {[regexp IBM_HEAPDUMP $p] == 1} {
      $AdminConfig modify $p {{value false}}
   }
}



   
$AdminConfig save   

### Synchronize nodes

set Sync1 [$AdminControl completeObjectName type=NodeSync,node=$nname,*]

set xstatus [$AdminControl invoke $Sync1 sync]
puts $xstatus

if {$xstatus == "false"} {
    puts "Unable to synchronize..."
}

   
}   
   
   
   
###   
### Main   
###   
   
   
if { !($argc == 3) } {   
   puts ""   
   puts "Usage:  "   
   puts " "   
   puts "wsadmin.sh -username system -password password -f set_HEAPDUMP.jacl cellname nodename servername " 
   puts ""   
   puts "For example:  "   
   puts " "   
   puts "wsadmin.sh -username was -password acme@ -f  set_HEAPDUMP.jacl hostnameNetwork hostname ops_1_1 " 
} else {    
   set xcell        [lindex $argv 0]     
   set xnode        [lindex $argv 1]     
   set xserver      [lindex $argv 2]     
   set_HEAPDUMP $xcell $xnode $xserver 
}