Determining whether your session is connected to a DTU
By bhlackey on Aug 18, 2006
It's important to understand that your CAM applications run in the background even when you disconnect your session (remove card or unplug the DTU).
This is great, but in some cases you don't want your script to preceed or maybe you want to avoid operations which need the DTU identifier.
The Citrix ICA client is one of those applications which you don't want starting in a session which is disconnected. It will error out with "Can't get Host ID" and your users will be confused the next time they insert their card.
Bob Doolittle sent me a little trick he uses in scripts to check if it is running in a connected or disconnected session.
if /opt/SUNWut/bin/utaction -e -i -c true -d false; then # Do Connected actions echo "Connected" else # Do Disconnected actions echo "Disconnected" fi
Another potential way of using utaction in this method is:
CONNECTED=$(/opt/SUNWut/bin/utaction -e -i -c "echo yes" -d "echo no")
Here is an example using the Citrix client
#!/bin/sh # Fix Alt-Tab xmodmap -e "clear mod1" # Fix Printscreen, alt+printscreen xmodmap -e 'keycode 77 = 0xff61' # set numlock on /usr/openwin/bin/xset led 1 while true ; do if /opt/SUNWut/bin/utaction -e -i -c true -d false; then # Start Citrix client /usr/lib/ICAClient/wfica -nosplash -quiet -desc Desktop fi sleep 2 done