Hacking on ThinPro: Preventing User Interruptions
Welcome to the life of a ThinPro admin. Every software update and OS upgrade brings fun new challenges (things break) and support from HP is pretty much always spotty. So, what do you do? Well, you get used to hacky workarounds.
Today's hack has to do with updating Imprivata. Most updates (we'll say 95-99%) will complete without any issues, but when you have a few thousand of these computers floating around the organization, that 1-5% gets to be sizable enough to require a scalable solution.
The solution is relatively straightforward; just disable and re-enable Imprivata on the target devices. The challenge is that this requires the local ThinPro user to be logged out a couple times. Now, HP Device Manager (HPDM) will allow the user to postpone reboots if they're in the middle of something, but the same functionality can't be applied to logouts, so there is a potential here to interrupt active Citrix sessions. I want to prevent that. I'll walk you through what I did.
First, I strung together some commands to find the process ID (PID) for any active Citrix sessions and stored it in a variable. If this looks complicated, it's really not. I'm just parsing through ps
output for a specific field.
wfica_session_pid=$(ps -eo pid,cmd | grep -v grep | sed 's/^\ *//' | grep wfica.bin | cut -d " " -f 1)
Next, I put that variable to use in a loop that periodically tested whether or not the variable was empty. You can see that the script will sleep while theĀ wfica_session_pid variable is not empty (a session exists). Every 5 seconds, it will check again. The loop will break when the variable is found to be empty (session no longer exists).
while [[ -n $wfica_session_pid ]] # <-- Testing for non-empty variable
do
echo "Citrix session is active with PID $wfica_session_pid"
sleep 5
wfica_session_pid=$(ps -eo pid,cmd | grep -v grep | sed 's/^\ *//' | grep wfica.bin | cut -d " " -f 1)
if [[ -z $wfica_session_pid ]] # <-- Testing for empty variable
then
echo "No Citrix sessions are active right now"
break
fi
done
Now that I have a way to watch for active Citrix sessions, I can toggle Imprivata off and on when nobody is using the computer. I'll cover how to handle that in another post.
Thanks for reading!
No comments to display
No comments to display