The wsadmin tool runs scripts. You can use the wsadmin tool to manage application servers as well as the configuration, application deployment, and server runtime operations.
Use the following command-line invocation syntax for the wsadmin scripting client:
wsadmin [-h(help)]
[-?] [-c command] [-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] [-conntype RMI [-host host_name] [-port port_number] [-user userid] [-password password] [-conntype JSR160RMI [-host host_name] [-port port_number] [-user userid] [-password password] [-conntype IPC [-ipchost host_name] [-port port_number] [-user userid] [-password password] [-jobid jobid_string] [-tracefile trace_file] [-appendtrace true/false] [script parameters]
The element script parameters represents any argument other than the ones listed previously. The argc variable contains the number of arguments, and the argv variable contains a list of arguments in the order that they were coded.
If you invoke the wsadmin tool with the -c option, any changes that you have made to the configuration are then saved automatically. If you make configuration changes and you are not using the -c option, then you must use the save command of the AdminConfig object to save the changes. Read about saving configuration changes with the wsadmin tool for more information.
Only one -f option can exist on the command line.
#test1.py def listServer(): print AdminConfig.list("Server")
#test2.py import test1 test1.listServer()
wsadmin -lang jython -f test2.py
server1(cells/myCell/nodes/myNode/servers/myServer|server.xml#Server_1183122130078)
wsadmin -javaoption java_option -javaoption java_option
To shorten the length of the command, you can type the command in the following way:
wsadmin -javaoption "java_option java_option"
This option overrides language determinations that are based on a script file name, a profile script file name, or the com.ibm.ws.scripting.defaultLang property. The -lang argument has no default value.
If you do not specify the -lang argument but you have the -f script_file_name argument specified, then the wsadmin tool determines the language based on a target script file name. If you do not specify the -lang argument and the -f argument, the wsadmin tool determines the language based on a profile script file name if the -profile profile_script_name argument is specified. If the command line or the property does not supply the script language, and the wsadmin tool cannot determine it, then an error message is generated.
Multiple -p options can exist on the command line. Those options invoke in the order that you supply them.
com.ibm.ws.scripting.noechoParamNo=3,5When you reference this text file in your wsadmin command, the third and fifth parameter values are not displayed in a trace file or standard output. To use the custom property, run the wsadmin command and pass the text file with the -p option. For example:
wsadmin -f script_file script_arguments -p text_file
wsadmin -lang jython -f script_file script_arguments -p text_file
For example:
wsadmin -f text.py server1 dbuser dbpassword user1 userpassword -p noecho.prop
dbpassword and userpassword are the third and fifth parameters that are not displayed in a trace file or standard output.
The profile script runs before other commands, or scripts. If you specify -c, then the profile script runs before it invokes this command. If you specify -f, then 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 are invoked in the order that you specify them.
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, JSR160RMI, IPC and NONE. For each connection type, you can specify additional attributes about the connection.
Attribute | Description |
---|---|
[-host host_name] | Specifies the host name for the connection. The default is the local host. |
[-port port_number] | Specifies the port number for the connection. |
[-user userid] | Specifies the user ID to use to establish the connection. |
[-password password] | Specifies the password to use to establish the connection. |
Attribute | Description |
---|---|
[-host host_name] | Specifies the host name for the connection. The default is the local host. |
[-port port_number] | Specifies the port number for the connection. |
[-user userid] | Specifies the user ID to use to establish the connection. |
[-password password] | Specifies the password to use to establish the connection. |
Attribute | Description |
---|---|
[-host host_name] | Specifies the host name for the connection. |
[-port port_number] | Specifies the port number for the connection. |
[-user userid] | Specifies the user ID to use to establish the connection. |
[-password password] | Specifies the password to use to establish the connection. |
Attribute | Description |
---|---|
[-ipchost host_name] | Specifies the host name for the connection. This attribute overrides the host name specified for the com.ibm.ws.scripting.ipchost property in the wsadmin.properties properties file. |
[-port port_number] | Specifies the port number for the connection. |
[-user userid] | Specifies the user ID to use to establish the connection. |
[-password password] | Specifies the password to use to establish the connection. |
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.
Use the following option with a class path string:
/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.
The following example specifies the job ID option, log location and appends the trace to the log file.
wsadmin -jobid wsadmin_test_1 -tracefile /temp/wsadmin_test_1.log -appendtrace true
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:
wsadmin -f test1.jacl -profile setup.jacl -conntype SOAP -port mymachine_soap_portnumber -host mymachine
Using Jython:
wsadmin -lang jython -f test1.py -profile setup.py -conntype SOAP -port mymachine_soap_portnumber -host mymachine
Using Jacl:
wsadmin -javaoption "-Xms128m -Xmx256m" -f test.jaclor
wsadmin -javaoption -Xms128m -javaoption -Xmx256m -f test.jacl
Using Jython:
wsadmin -lang jython -javaoption "-Xms128m -Xmx256m" -f test.pyor
wsadmin -lang jython -javaoption -Xms128m -javaoption -Xmx256m -f test.py
wsadmin -javaoption "-Dcom.ibm.websphere.management.application.client.jspReloadEnabled=true"
Using Jython:
wsadmin -lang jython -javaoption "-Dcom.ibm.websphere.management.application.client.jspReloadEnabled=true"
Enclose multiple Java options with double-quotation marks (""); for example:
wsadmin -javaoption "-Dcom.ibm.websphere.management.application.client.jspReloadEnabled=true -Dcom.ibm.websphere.management.application.enableDistribution=true"
wsadmin -conntype JSR160RMI -port JSR160rmiportnumber -user userid -password password
Using Jython:
wsadmin -lang jython -conntype JSR160RMI -port JSR160portnumber -user userid -password password
The element, rmiportnumber, for your connection is displayed in the administrative console as BOOTSTRAP_ADDRESS.
wsadmin -conntype RMI -port rmiportnumber -user userid -password password
Using Jython:
wsadmin -lang jython -conntype RMI -port rmiportnumber -user userid -password password
The element, rmiportnumber, for your connection is displayed in the administrative console as BOOTSTRAP_ADDRESS.
wsadmin -conntype NONE -c "$AdminApp uninstall app"
Using Jython:
wsadmin -lang jython -conntype NONE -c "AdminApp.uninstall('app')"