Example: Stopping running applications on a server using wsadmin
The following example stops all running applications on a server:
- Identify the application manager MBean for the server where the application resides, and assign it to the appManager variable.
set appManager [$AdminControl queryNames cell=mycell,node=mynode,type=ApplicationManager,process=server1,*]This command returns the application manager MBean.Example output:
WebSphere:cell=mycell,name=ApplicationManager,mbeanIdentifier=ApplicationManager,type=ApplicationManager,node=mynode,process=server1- Query the running applications belonging to this server and assign the result to the apps variable.
set apps [$AdminControl queryNames cell=mycell,node=mynode,type=Application,process=server1,*]This command returns a list of application MBeans.Example output:
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- Stop all the running applications.
foreach app $apps { set appName [$AdminControl getAttribute $app name] $AdminControl invoke $appManager stopApplication $appName }This command stops all the running applications by invoking the stopApplication operation on the MBean, passing in the application name to stop.