Starting the wsadmin scripting client using wsadmin scripting

You can use the wsadmin tool to configure and administer application servers, application deployment, and server run-time operations.

About this task

The 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:
  • The wsadmin tool only supports the Jython and Jacl scripting languages. The Version 6.1 release of WebSphere Application Server represented the start of the deprecation process for the Jacl syntax that is associated with the wsadmin tool. The Jacl syntax for the wsadmin tool continues to remain in the product and is supported for at least two major product releases. After that time, the Jacl language support might be removed from the wsadmin tool. The Jython syntax for the wsadmin tool is the strategic direction for WebSphere Application Server administrative automation. The application server provides significantly enhanced administrative functions and tooling that support product automation and the use of the Jython syntax.
  • The wsadmin tool manages the installation, configuration, deployment, and runtime operations for application servers, deployment managers, administrative agents, and job managers that run the same version or a higher version of the product. The wsadmin tool cannot connect to an application server, deployment manager, administrative agent, or job manager that runs a product version which is older than the version of the wsadmin tool. For example, a Version 6.x wsadmin client cannot connect to a Version 5.x application server. However, a Version 5.x wsadmin client can connect to a Version 6.x application server. This limitation exists because new functionality is added to the wsadmin tool in each product release. You cannot use new command functionality on application servers running previous product versions.
  • The wsadmin tool operates at the deployment manager node level in a mixed-cell environment. Do not run wsadmin at the application server node level to ensure that all command functionality is available.

The wsadmin launcher supports several scripting objects, including the AdminConfig, AdminControl, AdminApp, AdminTask, and Help objects. Scripts use these objects for application management, configuration, operational control, and for communication with MBeans that run in product processes. You must start the wsadmin scripting client before you perform any other task using scripting.

In a flexible management environment, you can connect the wsadmin tool to a base application server, deployment manager, administrative agent, or job manager process. If you do not specify the port of the base application server or the profile name assigned to the job manager, the wsadmin tool automatically connects to the administrative agent.

Procedure

  1. Locate the command that starts the wsadmin scripting client.
    Choose one of the following:
    • Invoke the scripting process using a specific profile. The QShell command for invoking a scripting process is located in the profile_root/bin directory. The name of the QShell script is wsadmin. If you use this option, you do not need to specify the -profileName profilename parameter.
    • Invoke the scripting process using the default profile. The wsadmin Qshell command is located in the app_server_root/bin directory. If you do not want to connect to the default profile, you must specify the -profileName profilename parameter to indicate the profile that you want to use.
  2. In a flexible management environment, determine whether to connect to a base application server, administrative agent, or job manager process.
    • Connect to the administrative agent process.
      Connect the wsadmin tool to the administrative agent to configure, manage, and administer servers. If you do not specify connection options, the wsadmin tool automatically connects to the administrative agent process. Use the following command to connect to the administrative agent:
      wsadmin -lang jython
    • Connect to a base application server process.
      Connect the wsadmin tool to a base application server to manage settings for a specific server of interest. Use this connection type when connecting to a node that contains one server and is registered with the administrative agent. Use the following command to connect to a base application server:
      wsadmin -conntype SOAP [-port 4213] -lang jython
    • Connect to the job manager process.
      Connect the wsadmin tool to the job manager to submit, monitor, and manage administrative jobs. Use the following command to connect to the job manager:
      wsadmin -profileName myJobManager -lang jython
  3. Review additional connection options for the wsadmin tool.
    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:
    Run scripting commands interactively

    Run wsadmin with an option other than -f or -c or without an option. The wsadmin tool starts and displays an interactive shell 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.

    The following examples launch the wsadmin tool:
    • [Windows] Launch the wsadmin tool using Jython:
      wsadmin.bat -lang jython
    • [AIX] [HP-UX] [Linux] [Solaris] Launch the wsadmin tool using Jython
      wsadmin.sh -lang jython
    • [Windows] Launch the wsadmin tool using Jython when security is enabled:
      wsadmin.bat -lang jython -user wsadmin -password wsadmin
    • [AIX] [HP-UX] [Linux] [Solaris] Launch the wsadmin tool using Jython when security is enabled:
      wsadmin.sh -lang jython -user wsadmin -password wsadmin
    • [Windows] Launch the wsadmin tool using Jacl with no options:
      wsadmin.bat -lang jacl
    • [AIX] [HP-UX] [Linux] [Solaris] Launch the wsadmin tool using Jacl with no options:
      wsadmin.sh -lang jacl
    Run scripting commands as individual commands

    Run the wsadmin tool with the -c option.

    [HP-UX] [Solaris] [AIX] [Linux] 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 ...".

    The following examples run commands individually:
    • [Windows] Run the list command for the AdminApp object using Jython:
      wsadmin -c "$AdminApp list"
    • [AIX] [HP-UX] [Linux] [Solaris] Run the list command for the AdminApp object using Jython:
      wsadmin.sh -lang jython -c 'AdminApp.list()'
    • [Windows] Run the list command for the AdminApp object using Jacl:
      wsadmin -lang jython -c "AdminApp.list()"
    • [AIX] [HP-UX] [Linux] [Solaris] Run the list command for the AdminApp object using Jacl:
      wsadmin.sh -c "\$AdminApp list"
      or
      wsadmin.sh -c '$AdminApp list'
    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.

    The following examples run scripts:
    • [Windows] Run the a1.py script using Jython:
      wsadmin -lang jython -f  al.py
    • [AIX] [HP-UX] [Linux] [Solaris] Run the a1.py script using Jython:
      wsadmin.sh -lang jython -f  al.py
    where the al.py file contains the following commands:
    apps = AdminApp.list()
    print apps
    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.

    The following examples run profile scripts:
    • [Windows] Run the a1prof.py script using Jython:
      wsadmin.bat -lang jython -profile alprof.py
    • [AIX] [HP-UX] [Linux] [Solaris] Run the a1prof.py script using Jython:
      wsadmin.sh -lang jython -profile alprof.py
    where the alprof.py file contains the following commands:
    apps = AdminApp.list()
    print "Applications currently installed:\n " + apps
    • [Windows] Run the a1prof.py script using Jacl:
      wsadmin.bat -profile alprof.jacl
    • [AIX] [HP-UX] [Linux] [Solaris] Run the a1prof.py script using Jacl:
      wsadmin.sh -profile alprof.jacl
    where the alprof.jacl file contains the following commands:
    set apps [$AdminApp list]
    puts "Applications currently installed:\n$apps"

Results

The wsadmin returns the following output when it establishes a connection to the server processs:

Jthon 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>
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>
Task topic    

Terms of Use | Feedback

Last updated: Oct 20, 2010 7:53:43 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-nd-dist&topic=txml_launchscript
File name: txml_launchscript.html