Monday Feb 18, 2008

Reaping (culling) Sun Ray sessions after a disconnect

Here's a simple way of conserving system resources under Solaris when you have a lot more users than Sun Rays. The idea is that if a user doesn't connect back to his session after a grace period, then his session is destroyed. Just make sure that your users know that their sessions have a limited time span, so they can save their work!

First, create a script called "reap-session" somewhere in your system, let's say /opt/SUNWut/scripts/reap-session. Make sure that you make it executable for everybody. The script, although very simple, is just there to save me some time :) in coding. It should be something like:

#!/bin/sh
GRACEPERIOD=7200      #That's two hours.
sleep $GRACEPERIOD
pkill Xsun

That's it for the little script.

Now, you need to invoke the script in the following manner, for those users whose sessions will be culled within GRACEPERIOD seconds - typically by executing in the .profile of the user:

/opt/SUNWut/bin/utaction -d /opt/SUNWut/scripts/reap-session -c "pkill reap-session " 1>/dev/null 2>&1 &

The way it operates is quite simple: as soon as the smartcard is pulled out, the timer is started via the disconnect utaction. If the user plugs his card back into the system before the timer goes off, then the connect utaction kills the timer and forgets the whole thing, to start afresh upon next pull of the card.

If, however, GRACEPERIOD elapses, then the timer goes off and the script kills the window manager for the user, and of course, with it, the whole session. Next time the user plugs his smartcard, he'll just see the login.

 

About

A thin thinker down under

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today