WLST script to update Graceful Shutdown parameters in weblogic server
A graceful shutdown gives WebLogic Server subsystems time to complete certain application processing currently in progress.
Graceful Shutdown
The Graceful Shutdown command transitions a server instance from the RUNNING state to the SHUTDOWN state, allowing work in process to be handled gracefully, with this sequence of state transitions:
RUNNING > SUSPENDING > ADMIN > SHUTTING_DOWN > SHUTDOWN
Controlling Graceful Shutdown
Ignore Sessions During Shutdown — If you enable this option WebLogic Server will drop all HTTP sessions immediately, rather than waiting for them to complete or timeout. Waiting for abandoned sessions to timeout can significantly lengthen the graceful shutdown process, because the default session timeout is one hour.
Graceful Shutdown Timeout — Specifies a time limit for a server instance to complete a graceful shutdown. If you supply a timeout value, and the server instance does not complete a graceful shutdown within that period, WebLogic Server performs a forced shutdown on the server instance.
This tutorial explains the approach to update graceful update parameters through WLST script in weblogic
WLST Script
The script will help us to update the Graceful Shutdown parameter for the servers in the weblogic domain.
UpdateGracefulShutdownParameters.py
def updateGraceFulShutdownTimings(): edit() startEdit() print print '##############' print '# Update Graceful Shutdown to 300 Seconds and ignore session true#' print '##############' print serverNames=cmo.getServers() 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 main(): adminURL='t3://localhost:7001' adminUserName='weblogic' adminPassword='weblogic1' connect(adminUserName, adminPassword, adminURL) updateGraceFulShutdownTimings() print 'Successfully updated Graceful Shutdown Parameters' disconnect() main()
Script
https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/UpdateGracefulShutdownParameters.py
Before executing the script, change the configurations as required.
Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd UpdateGracefulShutdownParameters.py
Now the Graceful Shutdown Parameters updated for all the servers in the domain