Monday, November 1, 2010

Getting started with scripting

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/welc6topmigrating.html


Scripting is a non-graphical alternative that you can use to configure and manage WebSphere Application Server.

The WebSphere Application Server wsadmin tool provides the ability to run scripts. The wsadmin tool supports a full range of product administrative activities.

The wsadmin tool supports two scripting languages: Jacl and Jython. Five objects are available when you use scripts:
  • AdminControl: Use to run operational commands.
  • AdminConfig: Use to run configurational commands to create or modify WebSphere Application Server configurational elements.
  • AdminApp: Use to administer applications.
  • AdminTask: Use to run administrative commands.
  • Help: Use to obtain general help.         

Procedure

  1. Locate the command that starts the wsadmin scripting client. [z/OS] The command for invoking a scripting process is located in the app_server_root /bin directory. Use the wsadmin.sh file.
    [AIX HP-UX Linux Solaris Windows] 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. 

    1. 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.  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] [z/OS] 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] [z/OS] 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] [z/OS] 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] [z/OS] 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] [z/OS] 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] [z/OS] Run the list command for the AdminApp object using Jacl:
    wsadmin.sh -c "\$AdminApp list"
    or
    wsadmin.sh -c '$AdminApp list'
    Run the a1.py script using
    Jython:wsadmin.sh -lang jython -f  al.py

No comments:

Post a Comment