A useful tip for CAM debugging
I have found that sometimes when I am debugging a new Controlled Access Mode (CAM) script, it can be frustrating to have to go back to the server for console access, particularly when I have CAM set for both card users and non-card users. Also, in trying to figure out why the script isn't doing what I think it should, it is handy to be able to check out the environment of the CAM user live. So, I tend to use a variant of the following script code to allow me to use a specific card to bring up a terminal window. From there I can check out the status of environment variables, etc, as well as launch other scripts or apps, to see what error codes or behavior I may be missing otherwise.
In order for this to work, you need to know the Sun Ray TOKEN for the card you are going to use. The easy way to figure out the TOKEN value is to use the same process the script code uses, and that is to check the value of the SUN_SUNRAY_TOKEN environment variable. For example, using the Bourne shell (sh) use:
In order for this to work, you need to know the Sun Ray TOKEN for the card you are going to use. The easy way to figure out the TOKEN value is to use the same process the script code uses, and that is to check the value of the SUN_SUNRAY_TOKEN environment variable. For example, using the Bourne shell (sh) use:
set | grep TOKENOr if using C shell (csh) use :
setenv | grep TOKENThe resulting output will look something like this :
>set | grep TOKEN SUN_SUNRAY_TOKEN=MicroPayflex.5001436700130100OK, now that you have your token, here is the code. Replace the 'MicroPayflex.5001436700130100' in the script code below with your own token from above.
# check for my card token and start terminal window if it is my card if [ "`set | /usr/bin/grep SUN_SUNRAY_TOKEN | /usr/bin/cut -c 18-`" = "MicroPayflex.5001436700130100" ];then # my card for shell access /usr/openwin/bin/xterm fiIf you use the same card, then it's easy enough to re-use the same chunk of code, but if you find you've left you usual card at home, it's not too hard to change. I hope you find this as useful as I do.

