Jython script to terminate all JVMs on Websphere Application server

1k Views Asked by At

I have a Websphere cell with 6 nodes(1 dmgr+5 nodeagents) and 30 jvms(5 jvms on each node). I want to kill all the 30 jvms by login into dmgr node server using wsadmin.sh from /opt/WebSphere/AppServer855/profiles/dmgrprofile/bin/. Could I have a jython script to achieve this? Please help me. Note: I do not want to kill nodeagents or dmgr. Thanks, Kumar.

1

There are 1 best solutions below

0
On

Use AdminTask.listServers command to get the list of all application servers in a cell, or on a specific node, and then iterate the list and stop server by using AdminControl.stopServer command.

all_servers=AdminTask.listServers('[-serverType APPLICATION_SERVER ]').splitlines()
for server in all_servers:
    serverName=AdminConfig.showAttribute(server, 'name')
    #stop server if its running
    try:
        AdminControl.stopServer(serverName,'immediate')
    except:
        print (serverName +" is not reachable")