Displaying script library help information using scripting

The script library provides Jython script procedures to assist in automating your environment. The script library includes help commands to list each available script library, display information for specific script libraries, and to display information for specific script procedures.

About this task

The scripting library provides a set of procedures to automate the most common application server administration functions. There are three ways to use the Jython script library.
  • Run scripts from the Jython script library in interactive mode with the wsadmin tool. You can launch the wsadmin tool, and run individual scripts that are included in the script library using the following syntax:
    wsadmin>AdminServerManagement.createApplicationServer("myNode", "myServer", "default")
  • Use a text editor to combine several scripts from the Jython script library, as the following sample displays:
    #
    # My Custom Jython Script - file.py
    #
    AdminServerManagement.createApplicationServer("myNode", "Server1", "default")
    AdminServerManagement.createApplicationServer("myNode", "Server2", "default")
    
    # Use one of them as the first member of a cluster
    AdminClusterManagement.createClusterWithFirstMember("myCluster", "APPLICATION_SERVER",
        "myNode", "Server1")
    
    # Add a second member to the cluster
    AdminClusterManagement.createClusterMember("myCluster", "myNode", "Server3")
    
    # Install an application
    AdminApplication.installAppWithClusterOption("DefaultApplication",
        "..\installableApps\DefaultApplication.ear", "myCluster") 
    
    # Start all servers and applications on the node
    AdminServerManagement.startAllServers("myNode")
    
    Save the custom script and run it from the command line, as the following syntax demonstrates:
    bin>wsadmin -language jython -f path/to/your/jython/file.py
  • Use the Jython scripting library code as sample syntax to write custom scripts. Each script example in the script library demonstrates best practices for writing wsadmin scripts. The script library code is located in the app_server_root/scriptLibraries directory. Within this directory, the scripts are organized into subdirectories according to functionality. For example, the app_server_root/scriptLibraries/application/V70 subdirectory contains procedures that perform application management tasks that are applicable to Version 7.0 and later of the product. The subdirectory V70 in the script library paths does not mean the scripts in that subdirectory are Version 7.0 scripts.

Use the AdminLibHelp script library to display general information about each script library, specific information about a specific script library, and information about specific scripts.

Procedure

  • Display general script library information.
    Use the following command invocation to display general script library information with the wsadmin tool:
    print AdminLibHelp()
  • Display scripts in a specific script library.
    You can also use AdminLibHelp script to display each script within a specific script library. For example, the following command invocation displays each script in the AdminApplication script library:
    print AdminLibHelp.help("AdminApplication")
  • Display detailed script information.
    Use the help script with the script library of interest to display detailed descriptions, arguments, and usage information for a specific script. For example, the following command invocation displays detailed script information for the listApplications script in the AdminApplication script library:
    print AdminApplication.help('listApplications')