Perform operations on running objects using the wsadmin scripting tool
Use scripting to invoke operations on running objects.
See the topic about starting the wsadmin scripting client.
We can run wsadmin commands that obtain the object names of running objects and perform operations:
Tasks
- Obtain the object name of the running object. For example:
- Jacl:
$AdminControl completeObjectName name- Jython:
AdminControl.completeObjectName(name)
Element Description $ Jacl operator for substituting a variable name with its value AdminControl Enable the manipulation of MBeans running in a product process completeObjectName AdminControl command name Fragment of the object name. It is used to find the matching object name. For example: type=Server,name=serv1,*. 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, for example:
- Jacl:
set s1 [$AdminControl completeObjectName type=Server,name=server1,*]- Jython:
s1 = AdminControl.completeObjectName('type=Server,name=server1,*')
Element Description set Jacl command s1 variable name $ Jacl operator for substituting a variable name with its value AdminControl Enable the manipulation of MBeans running in a product process completeObjectName AdminControl command type is the object name property key Server Name of the object name is the object name property key server1 Name of the server where the operation is invoked - Invoke the operation. For example:
- Jacl:
$AdminControl invoke $s1 stop- Jython:
AdminControl.invoke(s1, 'stop')
Element Description $ Jacl operator for substituting a variable name with its value AdminControl Enable the manipulation of MBeans running in a product process invoke AdminControl command s1 is the ID of the server that is specified in step number 3 stop n operation to invoke on the server
Example
The following example is for operations that require parameters:
- Jacl:
set traceServ [$AdminControl completeObjectName type=TraceService,process=server1,*] $AdminControl invoke $traceServ appendTraceString "com.ibm.ws.management.*=all=enabled"- Jython:
traceServ = AdminControl.completeObjectName('type=TraceService,process=server1,*') AdminControl.invoke(traceServ, 'appendTraceString', "com.ibm.ws.management.*=all=enabled")
Start the wsadmin scripting client wsadmin AdminControl Modifying attributes on running objects Commands for the AdminControl object