Index by: file name | procedure name | procedure call | annotation
startServers_proc.tcl (annotations | original source)

####################################################################
# Starts all servers and node agents within the cell. 
####################################################################
proc startServers { } {

   global AdminConfig 
   global AdminControl

   # display procedure arguments.

   set procName [ lindex [ info level 0 ] 0 ]

   putsLog "## proc - $procName"

   foreach i [ info args $procName ]  {

      upvar 0 $i ilocal

      set propertiesArray($i) $ilocal 

   }

   putsLog "procedure arguments are................."

   foreach { a b } [ array get propertiesArray ] {

       putsLog [ format "%-35s %s" "$a" "$b" ]

   }

   set cellName [ $AdminControl getCell ]

   # get a list of the application servers. 

   foreach i [ $AdminConfig list Server ] { lappend serverNameList [ $AdminConfig showAttribute $i name ] } 

   putsLog "installed servers are .............."

   foreach i $serverNameList { putsLog [ format "%-5s %-15s " " " $i ] }

   # get a list of the running servers 

   foreach i [ $AdminControl queryNames type=Server,* ] {

       lappend runningServerList [ list [ $AdminControl getAttribute $i name ] [ $AdminControl getAttribute $i processType ] ]

   }

   # display the running servers 

   putsLog "running servers are .............."

   foreach i $runningServerList { putsLog [ format "%-5s %-15s %-15s" " " [ lindex $i 0 ] [ lindex $i 1 ] ] }

   # list the servers by category.

   foreach i $runningServerList { 
       
       if { [ lindex $i 1 ] == "ManagedProcess" } { 

	       lappend jvmList [ lindex $i 0 ]

       }


       if { [ lindex $i 1 ] == "NodeAgent" } { 

	       lappend nodeAgentList [ lindex $i 0 ]

       }

       if { [ lindex $i 1 ] == "DeploymentManager" } { 

	       lappend dmList [ lindex $i 0 ]

       }
   }

   # extract the running servers from the list
   # lsearch returns -1 if there is no match 
   # ix contains server name

   foreach i $runningServerList {  
 
      if { [ set ix [ lsearch $serverNameList [ lindex $i 0 ] ] ] == -1 } {

	  # break to next iteration of loop  
	  continue

      }

      set serverNameList [ lreplace $serverNameList $ix $ix ]

   }

   # The deployment manager is already started. 
   # The node agent needs to be started. 

   # start the application servers.

   foreach i $serverNameList {

       set serverId [ $AdminConfig getid /Server:$i/ ]

       regexp {(.*nodes\/)(.*)(\/servers.*)} $serverId a b c d  

       set nodeId [ $AdminConfig getid /Node:$c/ ]

       #if { [ $AdminConfig getObjectName $nodeId ] == {} } {
       #    
       #   putsLog "ERROR: Node $c is not running"

       #   # break to next iteration of loop 

       #   continue 

       #}

       putsLog "starting server : $i ................."

       if { [ catch { $AdminControl startServer [ lindex $i 0 ] $c } r ] == 0 } {

	   putsLog "[ string range $r [ string first WAS $r ] end ]"  

       } else {

	   putsLog "[ string range $r [ string first WAS $r ] end ]"   
	   putsLog $r  
	   return -code error $r

       }

   }

}

Index by: file name | procedure name | procedure call | annotation
File generated 2007-08-07 at 13:42.