Configure processes using scripting

 

Procedure

  1. Start wsadmin

  2. Identify the server and assign it to the s1 variable. For example:

    • Jacl:

      set s1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
      

    • Jython

      s1 = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
      print s1
      

    where:

    set is a Jacl command
    s1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WAS configuration
    getid is an AdminConfig command
    Cell is the object type
    mycell is the name of the object that will be modified
    Node is the object type
    mynode is the name of the object that will be modified
    Server is the object type
    server1 is the name of the object that will be modified
    print a Jython command

    Example output:

    server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)
    

  3. Identify the process definition belonging to this server and assign it to the processDef variable. For example:

    • Jacl:

      set processDef [$AdminConfig list JavaProcessDef $s1]
      set processDef [$AdminConfig showAttribute $s1 processDefinition]
      

    • Jython:

      processDef = AdminConfig.list('JavaProcessDef', s1)
      print processDef
      processDef = AdminConfig.showAttribute(s1, 'processDefinition')
      
      

    Example output:

    (cells/mycell/nodes/mynode/servers/server1|server.xml#JavaProcessDef_1)
    

  4. Change the attributes.

    • On distributed systems, the following example changes the working directory.

      • Jacl:

        $AdminConfig modify $processDef {{workingDirectory c:/temp/user1}}
        

      • Jython:

        AdminConfig.modify(processDef, [['workingDirectory', 'c:/temp/user1']])
        

    • The following example modifies the stderr file name:

      • Jacl:

        set errFile [list stderrFilename \${LOG_ROOT}/server1/new_stderr.log]
        set attr [list $errFile]
        $AdminConfig modify $processDef [subst {{ioRedirect {$attr}}}]
        

      • Jython:

        errFile = ['stderrFilename', '\${LOG_ROOT}/server1/new_stderr.log']
        attr = [errFile]
        AdminConfig.modify(processDef, [['ioRedirect', [attr]]])
        

    • The following example modifies the process priority:

      • Jacl:

        $AdminConfig modify $processDef {{execution {{processPriority 15}}}}
        

      • Jython:

        AdminConfig.modify(processDef, [['execution', [['processPriority', 15]]]])
        

    • The following example changes the maximum startup attempts. We can modify this example to change other attributes in the process definition object.

      • Jacl:

        $AdminConfig modify $processDef {{monitoringPolicy {{maximumStartupAttempts 1}}}}
        $AdminConfig save
        

      • Jython:

        AdminConfig.modify(processDef, [['monitoringPolicy', [['maximumStartupAttempts',  1]]]])
        

  5. In a network deployment environment only, synchronize the node.


 

See Also


AdminConfig object for scripted administration

 

See Also


Commands for the AdminConfig object