Determining whether your session is connected to a DTU

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 
        
    
Comments:

Post a Comment:
Comments are closed for this entry.
About

Think Thin is a collection of bloggers that work with Oracle's Virtual Desktop portfolio of products.

Search

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