Before you begin
Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.Why and when to perform this task
The following example stops all running applications on a server:
Steps for this task
set appManager [$AdminControl queryNames cell=mycell,node=mynode,type= ApplicationManager,process=server1,*]
appManager = AdminControl.queryNames('cell=mycell,node=mynode,type= ApplicationManager,process=server1,*') print appManager
set | is a Jacl command |
appManager | is a variable name |
$ | 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 WebSphere server process |
queryNames | is an AdminControl command |
cell=mycell,node=mynode,type= ApplicationManager,process=server1 | is the hierarchical containment path of the configuration object |
is a Jython command |
This command returns the application manager MBean.
WebSphere:cell=mycell,name=ApplicationManager,mbeanIdentifier=ApplicationManager, type=ApplicationManager,node=mynode,process=server1
set apps [$AdminControl queryNames cell=mycell,node=mynode,type=Application, process=server1,*]
# get line separator import java.lang.System as sys lineSeparator = sys.getProperty('line.separator') apps = AdminControl.queryNames('cell=mycell,node=mynode,type=Application, process=server1,*').split(lineSeparator) print apps
set | is a Jacl command |
apps | is a variable name |
$ | 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 WebSphere server process |
queryNames | is an AdminControl command |
cell=mycell,node=mynode,type= ApplicationManager,process=server1 | is the hierarchical containment path of the configuration object |
is a Jython command |
This command returns a list of application MBeans.
WebSphere:cell=mycell,name=adminconsole,mbeanIdentifier=deployment.xml #ApplicationDeployment_1,type=Application,node=mynode,Server=server1, process=server1,J2EEName=adminconsole WebSphere:cell=mycell,name=filetransfer,mbeanIdentifier=deployment.xml #ApplicationDeployment_1,type=Application,node=mynode,Server=server1, process=server1,J2EEName=filetransfer
foreach app $apps { set appName [$AdminControl getAttribute $app name] $AdminControl invoke $appManager stopApplication $appName}
for app in apps: appName = AdminControl.getAttribute(app, 'name') AdminControl.invoke(appManager, 'stopApplication', appName)
Result
Once you complete the steps for this task, all running applications on the server are stopped.Related concepts
AdminControl object for scripted administration
Related tasks
Starting applications with scripting
Related reference
Commands for the AdminControl object