Run administrative jobs using wsadmin scripting
Submit and track administrative jobs in a flexible management environment using the wsadmin tool.
Configure a job manager, administrative agent, and register nodes and deployment managers 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 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.
- Launch the wsadmin tool. Navigate to app_server_root/bin and connect the wsadmin tool to the job manager process:
wsadmin -profileName myJobManager -lang jython
- Submit the administrative job to the job manager.
Use the submitJob command to submit administrative jobs. Job submissions consist of the following information:
- Job type
- Type of job to perform. Many jobs exist in the flexible management environment including application management, configuration, and application server runtime control jobs.
- Job target list and target group
- Nodes and node groups where the job runs.
- Job specific parameters
- Most administrative 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. The user name and password or the credentials for the submitter must be applicable to all of the job targets.
- Optional generic parameters
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 the timezone. 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 timezone, the system uses the timezone of the server. String expirationDateTime Expiration date for the job, in the format "2006-05-03T10:30:45-0000". The "-0000" section of the expirationDateTime parameter value represents the timezone 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 timezone, the system uses the timezone 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 address the system sends job notifications to. String
The following example submits a job to start an application server. 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 firstname.lastname@example.org')
- Optional: Monitor the job status.
Use the getOverallJobStatus command to display the status of the job:
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 the system has not attempted.
What to do next
Submit additional administrative jobs to the job manager and monitor existing jobs. We can also schedule future administrative jobs.
Registering nodes with the job manager AdministrativeJobs . ManagedNodeAgent . JobManagerNode .