Search This Blog

Saturday, June 15, 2013

SOA & ADF Bounce script


We were working on SOA doamin for automation with WLST. After woring on the retiring and activation  of  the composites of SOA_Infra we are ready for shutdown the managed servers. Now the task is simple we have break-down the task into two simple functions.

  1. stop the cluster
  2. start the cluster
  3. Main program
Here the main program uses the logic of fetching the cluster list from the admin server. The functions are made in such a way that each cluster control operation can be tracked with state command, that will tell about all the managed servers in the cluster state. Once we did a trial found that there could be some time required for shutdown the managed servers. Double checked the state with Console as well. Re-run the same script with the menu option to start the Cluster.

Here NodeManager is independently running on each machines where the cluster spread across the  managed servers are running. So, this script only controls the clustered managed servers.

You can extend the same script to turn down the Admin server as well. after cluster down you can have that action. The command is shutdown('AdminServer', 'Server')



If you want more stories on the automation go thru the recommended book!
  
#====================================
# 
# Description: This script objective is to provide the choices to perform operation
#    1 is for stop the cluster
#    2 is for start the cluster
#    other is for exit from this script
#  this uses two functions startClstr and stopClstr which takes parameter as 'cluster name'.
#
#====================================
# Stop all instances of a Cluster 
#====================================
def stopClstr(clstrName):
 try:
  shutdown(clstrName,"Cluster")
  java.lang.Thread.sleep(25000)
  state(clstrName,"Cluster")
 except Exception, e:
  print 'Error while shutting down cluster ',e
 
#====================================
# Startp all instances of a Cluster 
#====================================
def startClstr(clstrName):
 try:
  start(clstrName,"Cluster")
  state(clstrName,"Cluster")
 except Exception, e:
  print 'Error while shutting down cluster ',e
 

if __name__== "main":
 connect('weblogic','welcome1','t3://localhost:7001')
 print "1.To Stop Instances"
 print "2.To Start Instances"
 print "3.Exit from Menu"
 ch=input('Enter Your Choice: ')
 cd("Clusters")
 clstrList=ls(returnMap='true')
 if ch== 1 :
  for clstr in clstrList:
   stopClstr(clstr)
 elif ch == 2 :
  for clstr in clstrList:
   startClstr(clstr)
 else:
  exit()

No comments:

Facebook Blogger Plugin: By RNHckr.com

Post a Comment

Please write your comment here

Popular Posts