In a flexible management environment, you can submit the Run
wsadmin script job to run commands in a wsadmin script
file on managed nodes of the job manager. You must distribute the
wsadmin script file before you can submit jobs that run the script
file.
Before you begin
Before running the Run wsadmin script job,
do the following:
- Start the job manager and the target nodes. If a target node is
a stand-alone application server, also start the administrative agent.
- Develop the wsadmin script file.
For example, create a script
file named extract_server_props.py that has the
following script in the Jython language:
AdminTask.extractConfigProperties('[-propertiesFileName server.props -configData Server=server1 ]')
The
script runs the extractConfigProperties command to extract the server
configuration properties file of an application server named server1.
The server configuration properties are written to a file named server.props.
The
return code of the script determines the success or failure of a job
that runs the script. If the script has a return code of zero (0),
the job is successful. If the return code is a nonzero value, the
job fails.
For more information, see topics on wsadmin scripting.
- Copy the script file to the /config/temp/JobManager directory
of the job manager profile.
If the JobManager directory
does not exist, create the JobManager directory
in the job manager profile /config/temp directory.
To create and access the directory, you must have the appropriate
authority.
If the script file exists on a managed node, you
can run the Collect file job to copy the script
file from the managed node to the job_manager_profile/config/temp/JobManager/jobToken/nodeName directory.
See the topic on the collect file job.
- Run the Distribute file job to copy the
script file to managed nodes. Remember any destination value that
is specified when distributing the file. See the topic on the distribute
file job.
For the
extract_server_props.py script
example, you might assign a
Destination value
of
extract_server_props.py.
Avoid trouble: You
must distribute the script file to the target nodes before you can
run the
Run wsadmin script job. The distribute
file job copies the script file in the /config/temp/JobManager directory
of the job manager profile to the target nodes. The name of the script
file on the target nodes becomes whatever value that you specify for
the destination when distributing the file. See the topic on the distribute
file job.
gotcha
About this task
You can use the administrative console of the job manager
to submit a job that runs a wsadmin script file on selected nodes.
From the job manager console, choose the Run wsadmin script job,
specify the file, specify job options, schedule the job, review the
summary, and submit the job.
Instead of using the job manager
console, you can run the runWsadminScript job in the AdministrativeJobs
command group. See the Administrative job types topic.
Procedure
- Click from the navigation tree of the job manager administrative
console.
- Choose a job to run a script.
- Select the Run wsadmin script job
type from the list.
- Optionally describe the job.
- Click Next.
- Choose the targets on which you want to run the script.
- Select a group of nodes from the list, or select Node
names.
- If you selected Node names, then
specify a node name and click Add, or click Find and
specify the chosen nodes on the Find nodes page.
For
example, suppose that you submitted a job that distributed the extract_server_props.py Jython
script file. Specify nodes that have a server named server1.
If an administrative agent or deployment manager manages multiple
application server nodes that have a server named server1,
specify only one target node. When you specify multiple target nodes,
only the last created server.props file persists.
Previously created server.props files are overwritten.
- If user authentication is required, specify your user
name and password.
- Click Next.
- Specify job parameters.
- For Script file location, specify
the Destination value given when distributing
the script file.
For example, suppose that you submitted
a job that distributed the Jython script file extract_server_props.py and
assigned a Destination value of extract_server_props.py.
For Script file location, use the destination
value:
extract_server_props.py
For the extract_server_props.py script
to run successfully, the target nodes specified for Node
names must have a server named server1.
- For Profile location, optionally
specify the profile destination value that was given when the file
was distributed to the nodes.
- For Script parameters, specify
parameters that are needed to run the wsadmin script.
If
a parameter attribute contains any spaces, place double quotation
marks (") around the parameter. If a quoted parameter attribute contains
imbedded quotes, put a backslash before the imbedded quotes.
For the extract_server_props.py example,
optionally specify that wsadmin use the Jython language:-lang jython
- Click Next.
- Schedule the job.
The times and dates that
you specify are relative to the job manager.
- Optionally specify one or more e-mail addresses where
notifications are sent when the job finishes.
- Select when the job is available for submission.
You can submit the job to be available now, or specify a
time and date that the job is retrieved from the job manager.
- Select the job expiration.
- Optionally specify a recurring interval for the job,
a start date and time for the interval, and an end date and time for
the interval.
- Click Next.
- Review the summary, and click Finish to
submit the job.
Results
The target nodes run the job.
What to do next
On the Job status page, click the ID of the run wsadmin
script job and view the job status. Click the status refresh icon
to refresh the displayed status.
If
the job is not successful, view any error messages that result from
running the job, correct the error condition, and submit the job again.
If
the job status is Succeeded, verify that the script
ran successfully. For the extract_server_props.py example,
when the script runs successfully the target nodes extract the server1
properties to a file named server.props. A deployment
manager places the file in its main directory, for example, Dmgr01.
A stand-alone target node places the file in the main directory of
its administrative agent, for example, AdminAgent01.