Operating Systems: i5/OS
             Personalize the table of contents and search results

 

Start the wsadmin scripting client

 

You can use the wsadmin tool to manage a WebSphere Application Server installation, as well as configuration, application deployment, and server run-time operations.

 

Overview

The WebSphere Application Server wsadmin tool provides the ability to automate configuration tasks for your environment by running scripts. However, there are some limitations for using the wsadmin tool, including:

You must start the wsadmin scripting client before you perform any other task using scripting.

 

Procedure

  1. Locate the command that starts the wsadmin scripting client. Choose one of the following:

  2. Start the wsadmin scripting client. You can start the wsadmin scripting client in several different ways. To specify the method for running scripts, perform one of the following wsadmin tool options:

    Option for starting the wsadmin scripting client: Explanation: Examples:
    Run scripting commands interactively

    Run wsadmin with an option other than -f or -c or without an option.

    An interactive shell is displayed with a wsadmin prompt. From the wsadmin prompt, enter any Jacl or Jython command. You can also invoke commands using the AdminControl, AdminApp, AdminConfig, AdminTask, or Help wsadmin objects.

    To leave an interactive scripting session, use the quit or exit commands. These commands do not take any arguments.

    Using Jython:

    wsadmin -lang jython

    By default security is enabled:

    wsadmin -lang jython -user wsadmin 
    
     -password wsadmin
    Using Jacl:

    wsadmin

    If security is enabled:

    wsadmin -user wsadmin -password wsadmin

    Example output: Jython example output:

    WASX7209I: Connected to process server1 
    on node myhost using SOAP connector;  
    The type of process is: UnManagedProcess
    WASX7029I: For help, enter: "$Help help"
    wsadmin>print AdminApp.list()
    DefaultApplication\nIBMUTC\nivtApp\nquery\nsampleEAR
    wsadmin>exit
    Jacl example output:

    WASX7209I: Connected to process server1 
    on node myhost using SOAP connector;  
    The type of process is: UnManagedProcess
    WASX7029I: For help, enter: "$Help help"
    wsadmin>$AdminApp list
    adminconsole
    DefaultApplication
    ivtApp
    wsadmin>exit
    Run scripting commands as individual commands

    Run the wsadmin tool with the -c option.

    On a Unix operating system, if you invoke a command that includes a dollar sign character ($) using the wsadmin -c option, the command line attempts to substitute a variable. To avoid this problem, escape the dollar sign character with a backslash character (\). For example: wsadmin -c "\$AdminApp install ...".

    Using Jython:

    wsadmin -lang jython -c "AdminApp.list()"
    Using Jacl:

    wsadmin -c "$AdminApp list"
    Example output:

    WASX7209I: Connected to process "server1" 
    on node myhost using SOAP connector;  
    The type of process is: 
    UnManagedProcess
    adminconsole
    DefaultApplication
    ivtApp
    Run scripting commands in a script

    Run the wsadmin tool with the -f option, and place the commands that you want to run into the file.

    Using Jython:

    wsadmin -lang jython -f  al.py
    where the al.py file contains the following commands:

    apps = AdminApp.list()
    print apps
    Example output:

    WASX7209I: Connected to process "server1" 
    on node myhost using SOAP connector;  
    The  type of process is: 
     UnManagedProcess
     adminconsole
     DefaultApplication
     ivtApp
    
    Run scripting commands in a profile script

    A profile script is a script that runs before the main script, or before entering interactive mode. You can use profile scripts to set up a scripting environment that is customized for the user or the installation. By default, the following profile script files might be configured for the com.ibm.ws.scripting.profiles profiles property in the app_server_root/properties/wsadmin.properties file:

    app_server_root/bin/securityProcs.jacl
    
    
    app_server_root/bin/LTPA_LDAPSecurityProcs.jacl

    By default, these files are in ASCII. If you use the profile.encoding option to run EBCDIC encoded profile script files, change the encoding of the files to EBCDIC.

    To run scripting commands in a profile script, run the wsadmin tool with the -profile option, and include the commands that you want to run into the profile script.

    To customize the script environment, specify one or more profile scripts to run.

    Do not use parenthesis in node names when creating profiles.

    Using Jython:

    wsadmin -lang jython -profile alprof.py
    where the alprof.py file contains the following commands:

    apps = AdminApp.list()
    print "Applications currently installed:\n " + apps
    Example output:

    WASX7209I: Connected to process "server1" 
    on node myhost using SOAP connector;  
    The type of process is: UnManagedProcess
    Applications currently installed:
     adminconsole
     DefaultApplication
     ivtApp
     WASX7029I: For help, enter: "Help.help()"
     wsadmin>
    Using Jacl:

    wsadmin -profile alprof.jacl
    where the alprof.jacl file contains the following commands:

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

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




}
Wsadmin tool