WAS v8.5 > Script the application serving environment (wsadmin) > Use the wsadmin scripting AdminControl object for scripted administrationPerforming operations on running objects using wsadmin.sh
We can use scripting to invoke operations on running objects.
Before starting this task, wsadmin must be running. 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:
- Obtain the object name of the running object. For example:
Jacl:
$AdminControl completeObjectName name
Jython:
AdminControl.completeObjectName(name)
AdminControl completeObjectName command description. Run the completeObjectName command with an object name.
Element Description $ is a Jacl operator for substituting a variable name with its value AdminControl is an object that enables the manipulation of MBeans running in a product process completeObjectName is an AdminControl command name is a 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,*')
- Invoke the operation. For example:
Jacl:
$AdminControl invoke $s1 stop
Jython:
AdminControl.invoke(s1, 'stop')
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")
Related
Start the wsadmin scripting client using wsadmin.sh
Use the wsadmin scripting AdminControl object for scripted administration
Modify attributes on running objects using wsadmin.sh
Reference:
Commands for the AdminControl object using wsadmin.sh