Reaping (culling) Sun Ray sessions after a disconnect
By vdiozguy on Feb 18, 2008
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:
GRACEPERIOD=7200 #That's two hours.
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.