WAS v8.5 > Script the application serving environment (wsadmin) > Configure servers with scripting

Modify variables using wsadmin.sh

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

Start the wsadmin scripting tool.

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

  1. Modify an application server variable.

    • Use AdminTask.

      • Jacl:

          $AdminTask setVariable {-interactive}
      • Jython:

          AdminTask.setVariable (['-interactive'])

    • Use the AdminConfig object.

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

      • 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
           } }
      • 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.

    Use the following command example to save your configuration changes:

      AdminConfig.save()


Related


Use the wsadmin scripting AdminConfig object for scripted administration


Reference:

Server settings configuration scripts
Commands for the AdminConfig object using wsadmin.sh


+

Search Tips   |   Advanced Search