Thursday, April 17, 2014

Updating the Graceful Shutdown parameters in weblogic server through WLST script.

Updating the Graceful Shutdown parameters in weblogic server through WLST script.

The script will help us to update the Graceful Shutdown parameter for the servers in the weblogic domain.

UpdateGracefulShutdownParameters.py

def conn():

    try:              
            adminURL='t3://'+domainProps.get('domain1.AdminIP')+':'+domainProps.get('domain1.AdminPort')
            adminUserName='weblogic'
            adminPassword=domainProps.get("domain1.AdminPasswd")
            connect(adminUserName, adminPassword, adminURL)
    except ConnectionException,e:
        print 'Unable to find admin server...'
        exit()

   
def updateGraceFulShutdownTimings():
    edit()
    startEdit()
    print
    print '##############'
    print '# Update Graceful Shutdown to 300 Seconds and ignore session true#'
    print '##############'
    print
    for name in serverNames:
        try:
            print 'Updating Server==>'+ name.getName()
            cd("/Servers/" + name.getName())
            cmo.setGracefulShutdownTimeout(300)
            cmo.setIgnoreSessionsDuringShutdown(true)
        except WLSTException,e:
            # this typically means the server is not active, just ignore
            print 'Exception While Update the attribute'
    print '========================================='
    save()
    activate()  

def quit():
        disconnect()
        exit()

if __name__== "main":
    conn()
    serverNames = cmo.getServers()
    updateGraceFulShutdownTimings()
    quit()

Execute the script:
cd %WLS_HOME%\common\bin
wlst.sh UpdateGracefulShutdownParameters.py





No comments:

Post a Comment