Running admin jobs using scripting


Use this topic to submit and track admin jobs in a flexible management environment using wsadmin.

Set a job manager, administrative agent, and register nodes and dmgrs with the job manager to set up a flexible management environment. We can optionally create management groups to simultaneously submit a job to multiple nodes.

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. Your ID at the job manager must be authorized for the administrator role or the operator role to submit jobs. When you submit 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 you submit 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.

 

  1. Launch wsadmin. Navigate to the APP_ROOT/bin directory and use the following command to connect wsadmin to the job manager process:

    wsadmin -profileName myJobManager -lang jython

  2. Submit the admin job to the job manager. Use the submitJob command to submit admin jobs. 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, configuration, and appserver runtime control jobs.

    Job target list and target group

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

    Job specific parameters

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

    When you submit 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.

    Optional generic parameters

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


    Table 1. submitJob optional generic parameter descriptions

    Parameter Description Type
    username Username to use to submit the job when security is enabled. String
    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 Specifies the 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
    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 that the system sends job notifications to. String

    The following example submits a job to start an appserver.

    The following command example submits the start application job, and sets the returned job token to the MyStartJob variable:

    myStartJob = AdminTask.submitJob('-jobType startApplication -targetList "[MyNode01]" -jobParams "[applicationName myApplication]" -email admin@company.com')

  3. Monitor the job status. Use the getOverallJobStatus command to display the status of the job, as the following example displays:

    AdminTask.getOverallJobStatus('[-jobTokenList [myStartJob]]')
    If we did not set the myStartJob variable in the previous step, specify the return value from the submitJob command for the -jobTokenList parameter. The command returns job status information for the job or jobs of interest. The system displays the following information in the overall job status:

    • The STATE attribute specifies the current state of the job.

    • The TOTAL_RESULTS attribute specifies the total number of jobs.

    • The DISTRIBUTED attribute specifies the number of distributed jobs.

    • The ASYNC_IN_PROGRESS attribute specifies the number of asynchronous jobs in progress.

    • The SUCCEEDED attribute specifies the number of successful jobs.

    • The PARTIALLY_SUCCEEDED attribute specifies the number of partially successful jobs. Partial success can occur, for example, when a node represents multiple servers, and only some of the servers on the node complete successfully.

    • The FAILED attribute specifies the number of failed jobs.

    • The REJECTED attribute specifies the number of rejected jobs.

    • The NOT_ATTEMPTED attribute specifies the number of jobs that the system has not attempted.

 

What to do next

Submit additional admin jobs to the job manager and monitor existing jobs. We can also schedule future administrative jobs.

 

Related tasks


Registering nodes with the job manager using scripting

 

Related


AdministrativeJobs
ManagedNodeAgent
JobManagerNode