I'm running a slightly-outdated version of SRSS, which I hope to update this summer. But as a result, the web management interface only works in Firefox 3.x and other browsers of that ilk. My linux desktop distro of choice has chosen to abandon the FF3.x line altogether, and only provide FF9 or higher. Because of this, managing my DTU sessions requires I go back to the good old commandline tools.

We use our Sun Rays in a classroom lab setting, all in kiosk mode where they can choose from one of two Windows Terminal Server sessions (using uttsc), or a remote Linux desktop (using Xeyphr). A common problem we have with our DTU sessions is they can get "stuck", preventing users from opening new sessions on them. Having unusable DTUs for an extended period of time is highly undesirable, in our case. We've labeled all the DTUs with a number, nice and big on the back of the monitor, so the instructor can see them clearly. We've also set this number in the "Other Info" field in the utdesktop database. So when an instructor tells me "desktop 17 won't let anybody login", I would look that up in the web gui, and then terminate the session in a couple of clicks. Having to revert back to cli tools, this becomes a bit more tricky, and I usually have to spend a few minutes looking up and remembering the correct syntax for the tools. So like any good sysadmin, I wrote a script to make this easier.

I have included the script below, feel free to steal and modify as you like. Basically, I'm looking up the desktop number using utdesktop, creating the session token string based on the Desktop ID, displaying the session for that token for user verification, and then killing the session if verified. There are probably other/better ways to do this (eg, collecting user input is only very basic and not rigorous at all), but this is working well enough for me, until I can get the latest SRSS installed which hopefully has a better-behaved java management interface. Those who normally eschew guis may find this useful regardless. Enjoy!

Seth

#!/usr/bin/bash

# utkill.sh
# author: Seth Galitzer, 2/1/2012
# Look up a DTU session based on it's label stored in Other Info, and kill it
#   if the user approves.

# set paths to ut binaries
SESSCMD=/opt/SUNWut/sbin/utsession
DESKCMD=/opt/SUNWut/sbin/utdesktop

# collect the Desktop ID
id=`$DESKCMD -l|grep " $1"|awk '{print $1}'`

# build the token identifier string
tok="pseudo.$id"

# look up the session to make sure it is valid, print it to the screen for user
#   to verify it's the one they want
$SESSCMD -l -t $tok
if [ $? -ne 0 ]; then
    echo "Error looking up session. Aborted.";
    exit 1;
fi

# confirm action
echo "Do you want to kill this session? (Y/N)"
read ans
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
    # kill the session and report results to user
    $SESSCMD -k -t $tok
    if [ $? -eq 0 ]; then
        echo "Session has been restarted"
    else
        echo "There was an error restarting the session"
    fi
else
    echo "Aborted"
fi

# end utkill.sh

--
Seth Galitzer
Systems Coordinator
Computing and Information Sciences
Kansas State University
http://www.cis.ksu.edu/~sgsax
[email protected]
785-532-7790
_______________________________________________
SunRay-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/sunray-users

Reply via email to