+

Search Tips   |   Advanced Search

Run administrative jobs across multiple nodes using wsadmin scripting

Use this topic to run administrative jobs across multiple nodes in a flexible management environment using the wsadmin tool.

After configuring the flexible management environment, we can submit, monitor, and manage jobs for the nodes that are registered with the job manager. Your ID at the job manager must be authorized for the administrator role or the operator role to submit jobs. When submitting a job, we can specify a user name and password for authentication and authorization at the target node or nodes. If we do not provide a user name and password in the job parameters, the credentials for the job submitter at the job manager are used for this purpose.

When submitting a job to multiple target nodes, the user name and password or the credentials for the submitter must be applicable to all of the job targets.

In the following example, a company has four branch offices located in Hursley, Berlin, Warsaw, and Paris, with an application server at each location. An application that runs on each application server frequently experiences a memory leak issue. While a development team fixes the application, it might be necessary for each location to frequently stop and restart the application server. Use the following steps to create a node group consisting of the application servers from each location, and schedule weekly recurring jobs to stop and restart the fthe application servers.


Tasks

  1. Connect the wsadmin tool to the job manager process:

      cd app_server_root/bin
      wsadmin -profileName myJobManager -lang jython

  2. Create a node group.

    The following example commands creates the European_Branch_Offices node group:

      AdminTask.createManagedNodeGroup('-groupName European_Branch_Offices -description "Management group for all European branch offices"')

  3. Add nodes to the node group.

    The following example commands add the Hursley_office, Berlin_office, Warsaw_office, and Paris_office nodes to the European_Branch_Offices node group:

      AdminTask.addMemberToManagedNodeGroup('-groupName European_Branch_Offices -managedNodeNameList "[Hursley_Node01][Berlin_Node01][Warsaw_Node01][Paris_Node01]"')

  4. Schedule an administrative job on the job manager.

    Use the submitJob command to submit the future administrative job. Job submissions consist of the following information:

      Job type

      The job type specifies the type of job to perform. Many jobs exist in the flexible management environment including application management, product maintenance, configuration, and application server runtime control jobs.

      Job target list and target group

      The job target list and target group specifies the nodes and node group where the job runs.

      Job specific parameters

      Most administrative jobs require configuration information in addition to the job type and target in order to run the job. Job parameters are specific to each job type.

      When submitting a job to multiple target nodes, the user name and password or the credentials for the submitter must apply to all the job targets.

      Optional generic parameters

      In addition to the job specific parameters, we can include any of the following optional parameters with the job submission:

      Parameter Description Type
      username Username to use to submit the job when security is enabled. String
      password Password for the username to use to submit the job when security is enabled. String
      description Description for the job. String
      activationDateTime Date and time to activate the job in the format "2006-05-03T10:30:45-0000". The -0000 section of the activationDateTime parameter value represents RFC 822 format. We can specify Z as a shortcut for Greenwich Mean Time (GMT), such as "2006-05-03T10:30:45Z". If we do not specify the time zone, the system uses the time zone of the server. String
      expirationDateTime Expiration date for the job, in the format "2006-05-03T10:30:45-0000". The -0000 section of the activationDateTime parameter value represents RFC 822 format. We can specify Z as a shortcut for Greenwich Mean Time (GMT), such as "2006-05-03T10:30:45Z". If we do not specify the time zone, the system uses the time zone of the server. String
      expireAfter Amount of time, in minutes, to wait before the job expires. Integer
      executionWindow Recurring interval for the job. String
      executionWindowUnit Recurring interval unit of measure for the value set by the executionWindow parameter. Specify DAILY to run the job daily, WEEKLY to run the job weekly, MONTHLY to run the job monthly, YEARLY to run the job annually, or CONNECTION to run the job each time the node connects and polls for jobs. String
      email Email address where the system sends job notifications. String

    The following example schedules two weekly recurring jobs. For this example, an application that runs on application servers at 4 branch offices frequently experiences a memory leak issue. While a development team fixes the application, it might be necessary to frequently stop and restart the application server. The following command examples schedule the job manager to stop and restart the server once a week, and notifies the system administrator when the server stops and restarts:

      AdminTask.submitJob('-jobType stopServer -group European_Branch_Offices -jobParams [serverName server1] -activationDateTime 2006-05-03T10:30:45Z -executionWindowUnit DAILY -executionWindow 13:00:00-14:00:00 -email system_admin@company.com')

      AdminTask.submitJob('-jobType startServer -group European_Branch_Offices -jobParams [serverName server1] -activationDateTime 2006-05-03T10:40:45Z -recurringIntervalUnits DAILY -recurringInterval 13:00:00-14:00:00 -email system_admin@company.com')

The jobs have been submitted to the queue and will run at the date and time specified by the command.


What to do next

Use the commands in the AdministrativeJobs command group to manage and query for administrative jobs in a flexible management configuration.

  • Registering nodes with the job manager
  • AdministrativeJobs .
  • ManagedNodeAgent .
  • JobManagerNode .