Wsadmin tool

 

Wsadmin tool

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

The command-line invocation syntax for the wsadmin scripting client is as follows:

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
]

[script parameters] 

Where script parameters represent any arguments other than the ones listed previously. The argc variable contains the argument number, and the argv variable contains the contents.

Options

-c

Designates to run a single command.

Multiple -c options can exist on the command line. They run in the order that you designate. You must save after using this command.

-f

Designates a script to run.

Only one -f option can exist on the command line.

-javaoption

Specifies a valid Java standard or a non-standard option.

Multiple -javaoption options can exist on the command line.

-lang

The language of the script file, the command, or an interactive shell. The possible languages include: Jacl and Jython. The options for the -lang argument include: jacl and jython.

This option overrides language determinations that are based on a script file name, or the com.ibm.ws.scripting.defaultLang property. The -lang argument has no default value. If the command line or the property does not supply the script language, and the wsadmin tool cannot determine it, an error message generates. This argument is required if not determined from the script file name.

-p

Specifies a properties file.

The file listed after -p, represents a Java properties file that the scripting process reads. Three levels of default properties files load before the properties file that you specify on the command line. The first level is the installation default, wsadmin.properties, which is located in the WebSphere Application Server properties directory. The second level is the user default, wsadmin.properties, which is located in your home directory. The third level is the properties file that the environment variable WSADMIN_PROPERTIES points to.

Multiple -p options can exist on the command line. They invoke in the order that you supply them.

-profile

Specifies a profile script.

The profile script runs before other commands, or scripts. If you specify -c, the profile script runs before it invokes this command. If you specify -f, the profile script runs before it runs the script. In interactive mode, you can use the profile script to perform any standard initialization that you want. You can specify multiple -profile options on the command line, and they invoke in the order that you supply them.

-profileName

The profile from which the wsadmin tool will run. Specify this option if one the following reasons apply:

  • You run the wsadmin tool from the WAS_HOME/bin directory and you do not have a default profile or you want to run in a profile other than the default profile.

  • You are currently in a profile bin directory but want to run the wsadmin tool from a different profile.

-?

Provides syntax help.

-help

Provides syntax help.

-conntype

The type of connection to use.

This argument consists of a string that determines the type, for example, SOAP, and the options that are specific to that connection type. Possible types include: SOAP, RMI, and NONE.

Use the -conntype NONE option to run in local mode. The result is that the scripting client is not connected to a running server. You can manage server configuration, the installation and the uninstallation of applications without the application server running.

-wsadmin_classpath

Use this option to make additional classes available to your scripting process.Follow this option with a class path string. For example:
/home/MyDir/Myjar.jar;/yourdir/yourdir.jar
The class path is then added to the class loader for the scripting process.

You can also specify this option in a properties file that is used by the wsadmin tool. The property is com.ibm.ws.scripting.classpath. If you specify -wsadmin_classpath on the command line, the value of this property overrides any value that is specified in a properties file. The class path property and the command-line options are not concatenated.

-host

Specify a hostname to which wsadmin should attempt to connect. The default wsadmin.properties file located in the properties directory of each WebSphere profile provides localhost as the value of the host property if this option is not specified.

-password

Specify a password to be used by the connector to connect to the server if security is enabled in the server.

Warning: On UNIX system, the use of -password option may result in security exposure as the password information becomes visible to the system status program such as ps command which can be invoked by other user to display all the running processes. Do not use this option if security exposure is a concern. Instead, specify user and password information in the soap.client.props file for SOAP connector or sas.client.props file for RMI connector. The soap.client.props and sas.client.props files are located in the properties directory of your WebSphere profile.

-username

Specify a user name to be used by the connector to connect to the server if security is enabled in the server.

-port

Specify a port to be used by the connector. The default wsadmin.properties file located in the properties directory of each WebSphere Application Server profile provides a value in the port property to connect to the local server.

Example

In the following syntax examples, mymachine is the name of the host in the wsadmin.properties file that is specified by the com.ibm.ws.scripting.port property:

SOAP connection to the local host

Use the options that are defined in the wsadmin.properties file.

SOAP connection to the mymachine host

Using Jacl:
wsadmin -f test1.jacl -profile setup.jacl -conntype SOAP -port mymachinesoapportnumber -host mymachine
Using Jython:
wsadmin -lang jython -f  test1.py -profile setup.py -conntype SOAP -port mymachinesoapportnumber -host mymachine

Initial and maximum Java heap size

Using Jacl:
wsadmin -javaoption -Xms128m -javaoption -Xmx256m -f test.jacl
Using Jython:
wsadmin -lang jython -javaoption -Xms128m -javaoption -Xmx256m -f test.py

RMI connection with security

Using Jacl:
wsadmin -conntype RMI -port  rmiportnumber -userid userid -password password
Using Jython:
wsadmin -lang jython -conntype RMI -port  rmiportnumber -userid userid -password password

Warning: On UNIX system, the use of -password option may result in security exposure as the password information becomes visible to the system status program such as ps command which can be invoked by other user to display all the running processes. Do not use this option if security exposure is a concern. Instead, specify user and password information in the soap.client.props file for SOAP connector or sas.client.props file for RMI connector. The soap.client.props and sas.client.props files are located in the properties directory of your WebSphere profile.

Local mode of operation to perform a single command

Using Jacl:
wsadmin -conntype NONE -c "$AdminApp uninstall app"

or Using Jython:

wsadmin -lang jython -conntype NONE -c "AdminApp.uninstall('app')"

or




Sub-topics
wsadmin tool performance tips

Related tasks
Starting the wsadmin scripting client