Perform operations on running objects using the wsadmin tool
Overview
You can use scripting to invoke operations on running objects.
Procedure
- Start wsadmin
- Obtain the object name of the running object. For example:
AdminControl.completeObjectName(name)For example...
AdminControl.completeObjectName(type=Server,name=server1,*)It can be any valid combination of domain and key properties. For example, type, name, cell, node, process, etc.
- Set the s1 variable to the running object...
- Use Jacl:
set s1 [$AdminControl completeObjectName type=Server,name=server1,*]
- Use Jython:
s1 = AdminControl.completeObjectName('type=Server,name=server1,*')where:
set Jacl command s1 variable name $ Jacl operator for substituting a variable name with its value AdminControl object that enables the manipulation of MBeans running in a WAS process completeObjectName AdminControl command type object name property key Server name of the object name object name property key server1 name of the server where the operation is invoked
- Invoke the operation. For example:
- Use Jacl:
$AdminControl invoke $s1 stop
- Use Jython:
AdminControl.invoke(s1, 'stop')where:
$ Jacl operator for substituting a variable name with its value AdminControl object that enables the manipulation of MBeans running in a WAS process invoke AdminControl command s1 ID of the server that is specified in step number 3 stop operation to invoke on the server
Example
The following example is for operations that require parameters:
- Use Jacl:
set traceServ [$AdminControl completeObjectName type=TraceService,process=server1,*]
$AdminControl invoke $traceServ appendTraceString "com.ibm.ws.management.*=all=enabled"
- Use Jython:
traceServ = AdminControl.completeObjectName('type=TraceService,process=server1,*')
AdminControl.invoke(traceServ, 'appendTraceString', "com.ibm.ws.management.*=all=enabled")
Use the AdminControl object for scripted administration
Modifying attributes on running objects with the wsadmin tool
Related Reference
Commands for the AdminControl object