Stopping clusters using scripting

Use scripting and the wsadmin tool to stop application server, generic server, and proxy server clusters.

Before you begin

There are multiple ways to complete this task. This topic uses the AdminControl object to stop clusters in your application server runtime. Alternatively, you can use the ClusterConfigCommands command group for the AdminTask object or the immediateStopAllRunningClusters, immediateStopSingleCluster, stopAllClusters, and stopSingleCluster scripts in the AdminClusterManagement script library to administer clusters.

Procedure

  1. Identify the Cluster MBean and assign it to the cluster variable.
    • Using Jacl:
      set cluster [$AdminControl completeObjectName cell=mycell,type=Cluster,name=cluster1,*]
    • Using Jython:
      cluster = AdminControl.completeObjectName('cell=mycell,type=Cluster,name=cluster1,*')
      print cluster
    This command returns the Cluster MBean.
    Example output:
    WebSphere:cell=mycell,name=cluster1,mbeanIdentifier=Cluster,type=Cluster,process=cluster1
    
  2. Stop the cluster.
    • Using Jacl:
      $AdminControl invoke $cluster stop
    • Using Jython:
      AdminControl.invoke(cluster, 'stop')
    This command invokes the stop operation on the Cluster MBean.