IBM


4.1.3 Changing the console session timeout

You might want to change the session timeout for the console application. This is the time it takes for the console session to time out after a period of idleness. The default is 30 minutes. To change the session timeout value...

1. Copy the following script into a file. See Example 4-1.

Example 4-1 Jython script to change the console session expiration

dep = AdminConfig.getid("/Deployment:isclite/" )
appDep = AdminConfig.list("ApplicationDeployment", dep )
sesMgmt = AdminConfig.list("SessionManager", appDep )

# check if existing sesMgmt there or not, if not then create a new one, if exist then modify it
if (sesMgmt == ""):
        # get applicationConfig to create new SessionManager
        appConfig = AdminConfig.list("ApplicationConfig", appDep )
        if (appConfig == ""):
                # create a new one
                appConfig = AdminConfig.create("ApplicationConfig", appDep, [] )
                # then create a new SessionManager using new Application Config just created
                sesMgmt = AdminConfig.create("SessionManager", appConfig, [] )
        else:
                #  create new SessionManager using the existing ApplicationConfig
                sesMgmt = AdminConfig.create("SessionManager", appConfig, [] )
        #endElse 
#endIf 

# get tuningParams config id
tuningParams = AdminConfig.showAttribute(sesMgmt, "tuningParams" )
if (tuningParams == ""):
        # create a new tuningParams 
        AdminConfig.create("TuningParams", sesMgmt, [["invalidationTimeout", <timeout value>]] )

else:
        #modify the existing one
        AdminConfig.modify(tuningParams, [["invalidationTimeout", <timeout value>]] )

#endElse 
# saving the configuration changes
AdminConfig.save()

2. Change the <timeout value> on the two lines of this sample to the new session expiration value. This number specifies the number of minutes the console preserves the session during inactivity.

3. Save the file to any directory using, for example, the filename timeout.py.

4. Start the wsadmin scripting client from the <was_home>/profiles/<profile>/bin directory.

Issue the following command.

wsadmin -f <path to jython file>/timeout.py


Redbooks ibm.com/redbooks

Next