+

Search Tips   |   Advanced Search

 

Configure processes using scripting

 

You can use scripting and the wsadmin tool to configure processes. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information.

 

Overview

Perform the following steps to configure a process:

 

Procedure

  1. There are two ways to perform this task. Choose one of the following:

    • Use the AdminTask object:

    • Use the AdminConfig object:

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

          Use Jacl:

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

        • Use Jython:

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

        where:

        set Jacl command
        s1 variable name
        $ Jacl operator for substituting a variable name with its value
        AdminConfig object representing the WebSphere Application Server configuration
        getid AdminConfig command
        Cell object type
        mycell name of the object that will be modified
        Node object type
        mynode name of the object that will be modified
        Server object type
        server1 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)
        

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

          Use Jacl:

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

          Use 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)
        

      3. Change the attributes.

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

            Use Jacl:

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

            Use Jython:

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

        • The following example modifies the stderr file name:

            Use Jacl:

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

            Use Jython:

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

        • The following example modifies the process priority:

            Use Jacl:

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

            Use Jython:

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

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

            Use Jacl:

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

            Use Jython:

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

  2. Save the configuration changes. See the Saving configuration changes with the wsadmin tool article for more information.

  3. In a network deployment environment only, synchronize the node. See the Synchronizing nodes with the wsadmin tool article for more information.



Use the AdminConfig object for scripted administration

 

Related Reference


Commands for the AdminConfig object