This post is about how to programatically log off the sessions that becomes Inactive.
The question came from a friend of mine and I did let him know that some of those sessions that you see in EAS which is not attached to an Application are all not inactive.
In the screenshot the Sessions for Huron is an active session (that's me), that user is an admin who might have executed a MaxL which is server specific.
However I thought it is fun to do this purely from a fun perspective and created a batch file for it. You can download it from here
What I'm doing in that script is first to get all sessions using display session all MaxL and spool that to a file.
There is a second MaxL which gives me all the applications that are there in the system display application all
Once I got the spool files I'm using for loop to get the required information.
What the script is doing is get the 2nd and 4th token, also I asked it to skip 4 lines, this is my header.
Here is the output of the above command
0 0 is the session you've logged in through MaxL (the one which triggered the display session command)
- - is the byproduct of our for loop (this line is producing that OK/INFO - 1241044 - Records returned: .)
Now to get the Cubes, I guess you get the idea now.
Again a for loop and get the first token
Now comes the comparison where I've to pass column 2 from App_Session.txt to Cubes.txt and get the ones which does match.
This is achieved using gawk and for loop
gawk compares and gives us the sessionid which is not associated with an application and in this case we'll get 0 0 - - and the reals ones.
Bring for loop to the picture and say eol=- this will remove - - and add an if condition which check whether the session id is not equal to 0 and add the ones which are not to the MaxL.
Here is the MaxL that is been created and the spool output.
One issue that I found while playing with this was you cannot use an encrypted MaxL for this.
You cannot use encrypted MaxL with display command.