Run the wsadmin tool

This topic describes how to start and stop an interactive wsadmin session and other ways to invoke wsadmin commands.

The interactive session is a shell environment in which you can run wsadmin commands and scripts.

You can also run a single command or script file without starting an interactive session, or run commands in a profile before the interactive session starts. The other ways that you can invoke wsadmin commands are:

Start wsadmin

To start an interactive wsadmin session, follow these steps:

  1. Enter the Start Qshell (STRQSH) command on an OS/400 command line.

  2. Use the cd command to change to the bin directory of the product installation root:

    cd /QIBM/ProdData/WebAS5/Base/bin
    or
    cd /QIBM/ProdData/WebAS5/ND/bin
  3. At the Qshell prompt, enter this command:

    wsadmin -instance instance

    where instance is the name of the instance that you want to administer.

Before you exit the interactive session, run this command to save your configuration changes:

$AdminConfig save

If you do not run this command, wsadmin discards your changes when you exit the interactive session.

Stop wsadmin

To exit wsadmin, enter this command at the wsadmin prompt:

exit

Run wsadmin commands individually

To run commands individually, specify the -c option when you run the wsadmin command.

wsadmin -instance instance -c '$AdminApp list'

WASX7209I: Connected to process "server" on node node using SOAP connector;
    The type of process is: UnManagedProcess
adminconsole
DefaultApplication
ivtApp

In this example, instance is the name of your WebSphere Application Server instance, server is the name of your application server, and node is the name iSeries host server:

When you run commands with the -c parameter, configuration changes are saved automatically. You do not need to run the $AdminConfig save command.

Run wsadmin commands in a script

To run commands in a script, specify the -f option when you run the wsadmin command:

wsadmin -instance instance -f 'script.jacl'

WASX7209I: Connected to process "server" on node node using SOAP connector;
    The type of process is: UnManagedProcess
 adminconsole
 DefaultApplication
 ivtApp

In this example, instance is the name of your WebSphere Application Server instance, server is the name of your application server, node is the name of the node where your instance runs, and script.jacl is the fully qualified path of a Jacl script that contains these commands:

set apps [$AdminApp list]
puts $apps

If you run a script file that makes changes to your application server's configuration, include the $AdminConfig save command at the end of the script. If you do not include this command, wsadmin does not save your changes.

After you run a script, wsadmin returns you to the Qshell prompt.

Run wsadmin commands in a profile

The wsadmin tool starts an interactive session after it runs the commands in a profile.

To run commands in a profile, specify the -profile option when you run the wsadmin command.

wsadmin -instance instance -profile 'profile.jacl'

WASX7209I: Connected to process "server" on node node using SOAP connector;
    The type of process is: UnManagedProcess
 Applications currently installed:
 adminconsole
 DefaultApplication
 ivtApp
 WASX7029I: For help, enter: "$Help help"
 wsadmin>

In this example, instance is the name of your WebSphere Application Server instance, server is the name of your application server, node is the name of the node where your instance runs, and profile.jacl is the fully qualified path of a profile that contains these commands:

set apps [$AdminApp list]
puts "Applications currently installed:\n$apps"