Idle Session Kill
From Sun Ray User Group Wiki
Contents |
Terminating Idle Sessions With xautolock
Idle Sun Ray sessions can be terminated with xautolock after a certain period of idle time. The below describes the quick setup of xautolock for Solaris with a 60 minute timeout.
Note: This is not a graceful logout and users will lose their work if it is not saved.
Download and install xautolock - the binary should
install in /usr/openwin/bin . Once installed you need to create two scripts: one for starting xautolock and the other for terminating the idle Sun Ray session. Copy the scripts below and be sure to pay special attention to the spacing on the pkill command.
1101.xauto
#!/bin/sh # # FILE: 1101.xauto # PURPOSE: Starts xautolock so that it terminates a session # after being idle for an hour. # /usr/openwin/bin/xautolock -time 60 -locker '/usr/local/sbin/xautokill' &
xautokill
#!/bin/ksh -p
#
# FILE: xautokill
# REFERENCES: Bob Doolittle [SunRay-Users] Problem with auto-logout on
# card users
# PURPOSE: Forcefully terminate sessions if idle for an hour.
# Used in conjunction with xautolock.
#
logger -p user.notice Terminating `echo $USER` Sun Ray session forcefully
pkill -f "^/usr/openwin/bin/Xsun ${DISPLAY%%.0} "
On OpenSolaris or systems where gnome-session-save --silent option is implemented (it's still not available on Solaris 10, see CR 6485550), it's better to replace the pkill with:
gnome-session-save --kill --silent
Place the 1101.xauto script into Xsession.d so that it starts up automatically when a user logs in.
# cp 1101.xauto /usr/dt/config/Xsession.d # chown root /usr/dt/config/Xsession.d/1101.xauto # chgrp bin /usr/dt/config/Xsession.d/1101.xauto # chmod 555 /usr/dt/config/Xsession.d/1101.xauto
Now place the xautokill script into some known location. If you use a different location from /usr/local/sbin be sure to reflect this in 1101.xauto .
# cp xautokill /usr/local/sbin # chmod a+x /usr/local/sbin/xautokill
Caveat Emptor
This approach is experimental. xautolock was not created with a shared server in mind. It has various undesirable behaviors such as spin waiting, that can consume shared resources. If you try this experiment it is suggested that you carefully monitor resource consumption by xautolock. Feedback to the community mail alias regarding success (or failure) of this approach would be appreciated, as it would help validate this approach for others. Maybe we should modify xautolock to make it "Sun Ray friendly" (e.g. event waits instead of spin loops, or if that's not possible at least reasonable delays between polls) and contribute it back to the FreshMeat community! Bob Doolittle promises to send beer money to any enterprising soul who accomplishes this feat (and volunteers to do code review first).
References
Sun Ray Users: Problem with auto-logout on card users - Bob Doolittle

