+

Search Tips   |   Advanced Search

Submit jobs to run commands on a remote host

We can submit the Run command on remote host job to run command-line utilities such as startServer, wsadmin commands, or operating system commands on a remote host. A WebSphere Application Server installation on the remote host is required to run product commands, but is not required for non-product commands.

Before we can run the Run command on remote host job:

Use the administrative console of the job manager or the deployment manager to submit a job that runs commands on a remote host. From the console, choose the Run command on remote host job, specify the remote host computer, specify the command to run, review the summary, and submit the job. After the job submission, the job manager runs the specified command and records any messages in job manager stdErr.txt or stdOut.txt logs.

(iSeries) The (iSeries) Run command on remote host job supports executing QShell command on IBM i target hosts.

Instead of using a console, we can run the runCommand job script in the AdministrativeJobs command group. See the Administrative job types topic.

To run wsadmin commands in jobs, we can also use the Run wsadmin script job, which additionally enables us to specify script parameters. See information about submitting jobs to run wsadmin scripts.


Tasks

  1. From the navigation tree of the administrative console, click...

      Jobs > Submit

  2. Choose a job to run a WAS command on a remote host target.

    1. Select the Run command on remote host job type from the list.

      The Run command on remote host job is only available in the list if the job manager has a host target. Stand-alone application servers or deployment managers registered with the job manager are targets, but not host targets.

    2. Optionally specify a description of the job.

    3. Click Next.

  3. Choose the job targets.

    1. Select a group of targets from the list, or select Target names.

    2. If we selected Target names, then specify a target name and click Add, or click Find and specify the chosen targets on the Find targets page.

      On the Find targets page, the job type is automatically set to runCommand to filter search results. Click Find on this page to view the list of hosts in the Excluded targets list. Select the target, click > to move the host name to the Chosen targets list> OK.

    3. If user authentication is required, specify a user name, password, or any other authentication values as needed.

    4. Click Next.

  4. Specify job parameters.

    1. For Command or script, specify the command or script to run on the host.

      For example, to run the versionInfo command in a bin directory of a product installation on the remote host, specify the following command:

      (UNIX) (ZOS)
      versionInfo.sh
      
      (iSeries)
      versionInfo
      
      (Windows)
      versionInfo.bat
      

      For Command or script, we can specify a command with arguments; for example:

      (UNIX) (ZOS)
      startServer.sh server1
      
      (iSeries)
      startServer server1
      
      (Windows)
      startServer.bat server1
      

    2. For Working directory, specify the fully qualified path of the directory where the command resides.

      By default, the working directory is set to the home directory of the user.

      For example, specify a bin directory of the product installation on a remote host:

      (UNIX) (ZOS)

      /WAS_v850/IBM/WebSphere/AppServer/bin
      
      (iSeries)
      /QIBM/ProdData/WebSphere/AppServer/V85/ND/bin
      
      (Windows)
      C:\WAS_v850\IBM\WebSphere\AppServer\bin
      

      If we use double-backslashes (\\) or a forward slash (/) for directory separators, the job might fail with an error. For Windows operating systems, use a single backslash (\) as a directory separator.

    3. Click Next.

  5. Schedule the job.

  6. Review the summary, and click Finish to submit the job.

The job manager runs the job. If the job options specify the command name and path correctly, the command runs on the host and any messages resulting from the command are written to job manager logs.

For the versionInfo example, a message such as the following is written to the stdOut.txt file in the profile_root/JobMgr01/config/temp/JobManager/job_ID/host_name/logs directory:

--------------------------------------------------------------------------------
IBM WebSphere Product Installation Status Report
--------------------------------------------------------------------------------

Report at date and time August 30, 2010 11:20:50 AM EDT

Installation
--------------------------------------------------------------------------------
Product Directory    C:\WAS_v850\IBM\WebSphere\AppServer
Version Directory    C:\WAS_v850\IBM\WebSphere\AppServer\properties\version
DTD Directory        C:\WAS_v850\IBM\WebSphere\AppServer\properties\version\dtd
Log Directory        C:\Documents and Settings\All Users\Application Data\IBM\Installation Manager\logs

Product List
--------------------------------------------------------------------------------
ND                   installed

Installed Product
--------------------------------------------------------------------------------
Name                 IBM WAS - ND
Version              8.0.0.0
ID                   ND
Build Level          build_2464
Build Date           8/17/10
Architecture         x86 (32 bit)
Installed Features   EJBDeploy tool for pre-EJB 3.0 modules
                     Sample applications                      Stand-alone thin clients and resource adapters
--------------------------------------------------------------------------------
End Installation Status Report
--------------------------------------------------------------------------------

For the startServer example that starts server1, the command starts server1 on the host. A message such as the following is written to the stdOut.txt file in the profile_root/JobMgr01/config/temp/JobManager/job_ID/host_name/logs directory:

ADMU0116I: Tool information is being logged in file
           C:\WAS_v850\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1\startServer.log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: server1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server server1 open for e-business; process id is 5384


What to do next

On the Job status page, click the ID of the runCommand job and view the job 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.

  • Restart the job manager
  • Restart the administrative agent
  • Restart the deployment manager
  • Submitting jobs to run wsadmin scripts
  • Administrative job types
  • New target settings
  • Find targets
  • Find target resources