Stop running applications on a server using wsadmin

 

 

Using Jacl

### Identify the application manager MBean for the server where the application
### resides, and assign it to the appManager variable.

set appManager [$AdminControl queryNames cell=cell,node=node,type=ApplicationManager,process=server,*]



### Query the running applications belonging to this server 
### and assign the result to the apps variable.

set apps [$AdminControl queryNames cell=cell,node=node,type=Application,process=server,*]



### Stop all the running applications.

foreach app $apps 
{
     set appName [$AdminControl getAttribute $app name]
     $AdminControl invoke $appManager stopApplication $appName
  }

 

Using Jython

### Query the running applications belonging to this server 
### and assign the result to the apps variable.

appManager = AdminControl.queryNames('cell=cell,node=node,type=ApplicationManager,process=server,*')
print appManager



# get line separator 
import  java.lang.System  as sys
lineSeparator = sys.getProperty('line.separator')

apps = AdminControl.queryNames('cell=cell,node=node,type=Application,process=server,*').split(lineSeparator)
print apps



### Stop all the running applications.
for app in apps...
    appName = AdminControl.getAttribute(app, 'name')
    AdminControl.invoke(appManager, 'stopApplication', appName)