Disable components using scripting
Overview
Perform the following steps to disable the name server component of a configured server. We can modify this example to disable a different component.
Procedure
- Start wsadmin
- Identify the server component and assign it to the nameServer variable.
Jacl:
set nameServer [$AdminConfig list NameServer $server] nameServer = AdminConfig.list('NameServer', server) print nameServer
Example output:
(cells/mycell/nodes/mynode/servers/server1|server.xml#NameServer_1)- List the components belonging to the server and assign them to the components variable.
Jacl:
set components [$AdminConfig list Component $server] components = AdminConfig.list('Component', server) print components
The components variable contains a list of components.
Example output:
(cells/mycell/nodes/mynode/servers/server1|server.xml#ApplicationServer_1) (cells/mycell/nodes/mynode/servers/server1|server.xml#EJBContainer_1) (cells/mycell/nodes/mynode/servers/server1|server.xml#NameServer_1) (cells/mycell/nodes/mynode/servers/server1|server.xml#WebContainer_1)- Identify the name server component and assign it to the nameServer variable.
Since the name server component is the third element in the list, retrieve this element by using index 2.
Jacl:
set nameServer [lindex $components 2] # get line separator import java lineSeparator = java.lang.System.getProperty('line.separator') arrayComponents = components.split(lineSeparator) nameServer = arrayComponents[2] print nameServer
Example output:
(cells/mycell/nodes/mynode/servers/server1|server.xml#NameServer_1)- Disable the name server component by changing the nested initialState attribute belonging to the stateManagement attribute. For example:
Jacl:
$AdminConfig modify $nameServer {{stateManagement {{initialState STOP}}}} $AdminConfig save AdminConfig.modify(nameServer, [['stateManagement', [['initialState', 'STOP']]]])
- In a network deployment environment only, synchronize the node.
See Also
AdminConfig object for scripted administration
See Also
Commands for the AdminConfig object