Disabling components using scripting

You can disable components by invoking operations with scripting and the wsadmin tool. This topic describes how to disable the nameServer component of a configured server. You can modify the examples in this topic to disable other components.

About this task

There are two ways to complete this task. This topic uses the AdminConfig object to stop components in your environment. Alternatively, you can use the configureStateManageable script in the AdminServerManagement script library to enable and disable components. The wsadmin tool automatically loads the script when the tool starts. Use the following syntax to configure PMI settings using the configureStateManageable script:
AdminServerManagement.configureStateManageable(nodeName, serverName, parentType, initialState)
For additional information and argument definitions, see the documentation for the AdminServerMananagment script library.

Procedure

  1. wsadmin 스크립트 도구를 시작하십시오.
  2. Identify the server component and assign it to the nameServer variable.
    • Using Jacl:
      set nameServer [$AdminConfig list NameServer $server]
    • Using Jython:
      nameServer = AdminConfig.list('NameServer', server)
      print nameServer
    Example output:
    (cells/mycell/nodes/mynode/servers/server1|server.xml#NameServer_1)
  3. List the components belonging to the server.

    List the components that are associated with the server, and assign the components to the components variable, as the following example demonstrates:

    • Using Jacl:
      set components [$AdminConfig list Component $server]
    • Using Jython:
      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)
  4. Identify the nameServer component.

    Parse the components to identify the nameServer 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 an index of 2, as the following example demonstrates:

    • Using Jacl:
      set nameServer [lindex $components 2]
    • Using Jython:
      # 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)
  5. Disable the nameServer component.

    Modify the nested initialState attribute belonging to the stateManagement attribute to disable the nameServer component, as the following example demonstrates:

    • Using Jacl:
      $AdminConfig modify $nameServer {{stateManagement {{initialState STOP}}}}
    • Using Jython:
      AdminConfig.modify(nameServer, [['stateManagement', [['initialState', 'STOP']]]])
  6. Save the configuration changes.
    다음 명령 예제를 사용하여 구성 변경사항을 저장하십시오.
    AdminConfig.save()
  7. In a network deployment environment only, synchronize the node.
    AdminNodeManagement 스크립트 라이브러리에 있는 syncActiveNode 또는 syncNode 스크립트를 사용하여 구성 변경사항을 노드에 전파하십시오.
    • 다음 명령 데모에 표시된 것과 같이, syncActiveNodes 스크립트를 사용하여 변경사항을 셀 내의 각 노드에 전파하십시오.
      AdminNodeManagement.syncActiveNodes()
    • 다음 명령 데모에 표시된 것과 같이, syncNode 스크립트를 사용하여 변경사항을 특정 노드에 전파하십시오.
      AdminNodeManagement.syncNode("myNode")

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: July 9, 2016 6:14
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_disablecomponent
파일 이름:txml_disablecomponent.html