+

Search Tips   |   Advanced Search

 

###
### set_log_rotation.jacl
###
###
###
###
###

proc set_log_rotation {sname} {


###
### set up globals
###

global AdminConfig
global AdminControl
global AdminApp


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 nname [$AdminConfig showAttribute $node name]

        set serverid [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/]

        if {[llength $serverid] == 0} {
           continue 
        }

        puts "Setting log rotation for node: $nname,  server: $sname"
        set log [$AdminConfig showAttribute $serverid outputStreamRedirect]
        $AdminConfig modify $log {{rolloverType BOTH} {rolloverSize 2} {rolloverPeriod 12} {baseHour 24}}
        set xlog [$AdminConfig show $log]
    }
}

$AdminConfig save

}



###
### Main
###


if { !($argc == 1) } {
   puts ""
   puts "Usage:, "
   puts " "
   puts "wsadmin.sh -username system -password password -f set_log_rotation.jacl appserver"
} else { 
   set xserver      [lindex $argv 0]  
   set_log_rotation $xserver 
}