Configuring processes using scripting

You can use scripting and the wsadmin tool to configure processes.

Before you begin

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.

About this task

Perform the following steps to configure a process:

Procedure

  1. There are two ways to perform this task. Choose one of the following:
    • Using the AdminTask object:
      • Using Jacl:

        $AdminTask setProcessDefinition {-interactive}
      • Using Jython:
        AdminTask.setProcessDefinition (['-interactive'])
    • Using the AdminConfig object:
      1. Identify the server and assign it to the s1 variable. For example:
        • Using Jacl:

          set s1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
        • Using 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 WebSphere Application Server 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)
      2. Identify the process definition belonging to this server and assign it to the processDef variable. For example:
        • Using Jacl:

          [AIX HP-UX Linux Solaris Windows]
          set processDef [$AdminConfig list JavaProcessDef $s1]
          set processDef [$AdminConfig showAttribute $s1 processDefinitions]
          [z/OS]
          set processDefs [$AdminConfig list JavaProcessDef $s1]
          set controllerProcessDef [lindex $processDefs 1]
          set servantProcessDef [lindex $processDefs 1]
        • Using Jython:

          [AIX HP-UX Linux Solaris Windows]
          processDef = AdminConfig.list('JavaProcessDef', s1)
          print processDef
          processDef = AdminConfig.showAttribute(s1, 'processDefinitions')
          
          [z/OS]
          processDefs = AdminConfig.list('JavaProcessDef', s1)
          # get line separator
          import java
          lineSeparator = java.lang.System.getProperty('line.separator')
          arrayPDs = processDefs.split(lineSeparator)
          controllerProcessDef = arrayPDs[0]
          servantProcessDef = arrayPDs[1]
          print controllerProcessDef
          print servantProcessDef

        Example output:

        [AIX HP-UX Linux Solaris Windows]
        (cells/mycell/nodes/mynode/servers/server1|server.xml#JavaProcessDef_1)
        [z/OS]
        (cells/mycell/nodes/mynode/servers/server1:server.xml#JavaProcessDef_1)
        (cells/mycell/nodes/mynode/servers/server1:server.xml#JavaProcessDef_2)
      3. Change the attributes.
        • [AIX HP-UX Linux Solaris Windows] On distributed systems, the following example changes the working directory.

          [z/OS] On z/OS systems, the following example shows how to change the process definition of the servant region. You can change the process definition of the controller region by substituting controllerProcessDef for servantProcessDef .

          • Using Jacl:

            [AIX HP-UX Linux Solaris Windows]
            $AdminConfig modify $processDef {{workingDirectory c:/temp/user1}}
            [z/OS]
            $AdminConfig modify $servantProcessDef {{workingDirectory /temp/user1}}
            [iSeries]
            $AdminConfig modify $processDef {{workingDirectory /home/myProfile/temp/user1}}
          • Using Jython:

            [AIX HP-UX Linux Solaris Windows]
            AdminConfig.modify(processDef, [['workingDirectory', 'c:/temp/user1']])
            [z/OS]
            AdminConfig.modify(servantProcessDef, [['workingDirectory', '/temp/user1']])
            [iSeries]
            AdminConfig.modify(processDef, [['workingDirectory', '/home/myProfile/temp/user1']])
        • The following example modifies the stderr file name:
          • Using Jacl:

            [AIX HP-UX Linux Solaris Windows] [iSeries]
            set errFile [list stderrFilename \${LOG_ROOT}/server1/new_stderr.log]
            set attr [list $errFile]
            $AdminConfig modify $processDef [subst {{ioRedirect {$attr}}}]
            [z/OS]
            set errFile [list stderrFilename \${LOG_ROOT}/server1/new_stderr.log]
            set attr [list $errFile]
            $AdminConfig modify $servantProcessDef [subst {{ioRedirect {$attr}}}]
          • Using Jython:

            [AIX HP-UX Linux Solaris Windows] [iSeries]
            errFile = ['stderrFilename', '\${LOG_ROOT}/server1/new_stderr.log']
            attr = [errFile]
            AdminConfig.modify(processDef, [['ioRedirect', [attr]]])
            [z/OS]
            errFile = ['stderrFilename', '${LOG_ROOT}/server1/new_stderr.log']
            attr = [errFile]
            AdminConfig.modify(servantProcessDef, [['ioRedirect', attr]])
        • The following example modifies the process priority:
          • Using Jacl:

            $AdminConfig modify $processDef {{execution {{processPriority 15}}}}
          • Using 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.
          • Using Jacl:

            $AdminConfig modify $processDef {{monitoringPolicy {{maximumStartupAttempts 1}}}}
          • Using 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.



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Feb 19, 2011 5:25:36 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v610web&product=was-nd-mp&topic=txml_processes
File name: txml_processes.html