Wsadmin

The wsadmin tool is a command shell for the purpose of performing systems administration on all the artifacts in an IBM WebSphere Application Server (WAS) cell. It gets its name from the name of the shell script that invokes this command shell. This command shell can execute connected to a WAS cell or completely disconnected from a WAS cell (local mode). The wsadmin tool can be used to execute scripts written in Jacl and Jython, or it can be used interactively to execute individual commands. These scripts and commands perform administrative tasks like application deployment, configuration changes and run-time monitoring and control of IBM WAS.

History of WebSphere Application Server command shells

The wscp stands for WebSphere Control Program. It was used in older versions of WAS like Version 4.0 and Version 3.5. The wsadmin command shell replaced wscp in WebSphere Application Server Version 5.0 and all subsequent versions. It can perform almost all of the tasks which can be done through the browser based administrative console, and it can perform some tasks that the administrative console cannot do.

Invoking wsadmin

There is a copy of the shell script that executes wsadmin in the bin directory of WAS install root and in the bin directory of every profile. With the exception of stand alone installations of WAS, wsadmin is almost always invoked from the bin directory of the deployment manager's profile. To invoke wsadmin in interactive mode,

  1. Open the command line window of the machine in which IBM WebSphere Application Server is already installed.
  2. Change directory to: <IBM WebSphere Profile Path>/bin/ (This will almost always be the bin directory of the deployment manager's profile)
  3. Execute the file named wsadmin.[sh | bat] . See invocation syntax for available options.
  4. You will see a wsadmin command line. Any commands you type will execute immediately. If you make configuration changes, those changes will not take effect unless you invoke the save command of the AdminConfig script object.

Invocation syntax

After invocation of wsadmin the command-line window will show the following text:

wsadmin [-h(help)] [-?] [-c <commands>] [-p <properties_file_name>] [-profile <profile_script_name>] [-profileName <profile_name>] [-f <script_file_name>] [-javaoption java_option] [-lang language] [-wsadmin_classpath classpath] [-conntype SOAP [-host host_name] [-port port_number] [-user userid] [-password password] RMI [-host host_name] [-port port_number] [-user userid] [-password password] NONE]

Options

The text written between squared brackets ([...]) are called options of the wsadmin tool.

     *If SOAP or RMI, then give relevant host_name, port_number, userid and password.
     *If NONE, then it will run in local mode.

Five script objects of wsadmin

Five script objects provide the commands that administrators execute to perform various administrative operations. Two of these - AdminControl and AdminConfig - are primitive objects. Two others - AdminApp, AdminTask - provide a more high level interface for administrative tasks. The final script object - Help - provides several different forms of help.

Two Modes of wsadmin

The wsadmin could be operated by two modes; a Remote mode and a Local mode.

Scripting languages: Jacl and Jython

The wsadmin supports Jacl[1] (an alternate implementation of TCL written in Java) and Jython (Java, Python) scripting languages. The choice of Jacl or Jython may depend on the programmer's comfort level. The Java/Java EE or C programmer may be more comfortable with Jython whereas Tcl experts may prefer Jacl. Though the script syntax is different, Jacl and Jython are equally powerful. The IBM Jacl to Jython Conversion Assistant program is used to convert wsadmin Jacl scripts into Jython.

Changing default language

In IBM WebSphere Application Server Version 6.1, the Jacl is deprecated. To use Jython as the scripting language, either of the two following ways.

To change default language, consider the following steps: (It is for Unix based systems.)

Basic difference between Jacl and Jython syntaxes

Here, five basic commands (for getting help for the relevant objects) are written in their particular syntaxes. The case-sensitiveness in the scripting must be the crucial thing to be taken care of.

Jacl Jython
puts $Help help print Help.help()
puts $AdminConfig help print AdminConfig.help()
puts $AdminTask help print AdminTask.help()
puts $AdminControl help print AdminControl.help()
puts $AdminApp help print AdminApp.help()

Proficiency in scripting

Points to keep in mind

Tips / Gotchas / Limitations in wsadmin

Multiple nested statements inside [] cannot directly be used unless assigned to a variable
print() statements are needed to interpret and/or convert formatting of output

References

This article is issued from Wikipedia - version of the 3/19/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.