Modifying variables using wsadmin scripting

Use scripting and the wsadmin tool to modify variables in the application server.

Before you begin

啟動 wsadmin Scripting 工具。

About this task

There are two ways to modify an application server variable. You can use an AdminTask object or an AdminConfig object.

Procedure

  1. Modify an application server variable.
    • Use the AdminTask object.
      • Using Jacl:

        $AdminTask setVariable {-interactive}
      • Using Jython:

        AdminTask.setVariable (['-interactive'])
    • Use the AdminConfig object.

      The following examples modify the DB2_JDBC_DRIVER_PATH variable on the node level:

      • Using Jacl:

        set varName DB2_JDBC_DRIVER_PATH
        set newVarValue C:/SQLLIB/java
        set node [$AdminConfig getid /Node:myNode/]
        set varSubstitutions [$AdminConfig list VariableSubstitutionEntry $node]
        
        foreach varSubst $varSubstitutions {
           set getVarName [$AdminConfig showAttribute $varSubst symbolicName]
           if {[string compare $getVarName $varName] == 0} {
              $AdminConfig modify $varSubst [list [list value $newVarValue]]
              break
           } 
        }
      • Using Jython:

        varName = "DB2_JDBC_DRIVER_PATH"
        newVarValue = "C:/SQLLIB/java"
        node = AdminConfig.getid("/Node:myNode/")
        varSubstitutions =
           AdminConfig.list("VariableSubstitutionEntry",node).split(java.lang.System.getProperty("line.separator"))
        
        for varSubst in varSubstitutions:
           getVarName = AdminConfig.showAttribute(varSubst, "symbolicName")
           if getVarName == varName:
              AdminConfig.modify(varSubst,[["value", newVarValue]])
              break
  2. Save the configuration changes.
    請利用下列指令範例來儲存您的配置變更:
    AdminConfig.save()
  3. In a network deployment environment only, synchronize the node.
    請利用 AdminNodeManagement Script 程式庫中的 syncActiveNode 或 syncNode Script,將配置變更傳播給節點。
    • 利用 syncActiveNodes Script,依照下列範例所示,將變更傳播給 Cell 中的每個節點:
      AdminNodeManagement.syncActiveNodes()
    • 利用 syncNode Script,依照下列範例所示,將變更傳播給特定的節點:
      AdminNodeManagement.syncNode("myNode")

指出主題類型的圖示 作業主題



時間戳記圖示 前次更新: July 9, 2016 11:19
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_variable
檔名:txml_variable.html