Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Our Setup of rpitc
14-12-2014, 07:05 AM,
#1
Our Setup of rpitc
In our office we use rpitc in production and employ scripts as well as a GUI Gibbio has built. Here's the scoop...

For our secretary and accountant we use rpitc with Gibbio's RDPGui (http://rpitc.blogspot.ca/2013/09/freerdp...lient.html)

Looks very professional and works great.

The rest our rpitc thin clients are used for our workstations where employees have the need to float from one workstation to the next. We leave the raspberry pi thin client logged in to it's

assigned virtual machine with a generic ID (All workstations are locked down with no Internet Access or limited network access). I have scripts on our Pi's run at boot that will autologin based

on the Pi's hostname. To achieve this I've created the following:

ConnectConfig file:

This file lists all the data my bash script will use to login to the VM it is assigned.

Code:
THINCL1  10.100.86.5 User1 MyPass 10.100.86.55
THINCL2  10.100.86.6 User1 MyPass 10.100.86.56
THINCL3  10.100.86.7 User1 MyPass 10.100.86.57
THINCL4  10.100.86.8 User1 MyPass 10.100.86.58

The layout of the above config file is as follows:
Thin Client Hostname IP of computer Pi connects too Login ID of remote computer Password of remote computer IP Address of Pi

WorkstationConnect.sh

I then created the following bash script which checks if rdesktop is running. If rdesktop is not running the script will read my ConnectConfig file, find the hostname assigned to this particular

rpitc thin client and find a match. It will find the IP of the remote computer using the credentials in the ConnectConfig file.

This of course is very insecure...I've saved my generic id and password in this file for anyone to read..but again these are generic workstations used by any and all in our office so everyone

knows what the password is to use these anyway. I wouldn't suggest this method for anyone who wants to keep the userid and password more secret.

Code:
#!/bin/bash
Logfile=/home/rpitc/scripts/Connect.log
ConfigFile=/home/rpitc/scripts/ConnectConfig
echo $ConfigFile
ThisHost=$(hostname)
echo $ThisHost
# Check if rdesktop is running
if pgrep rdesktop > /dev/null
then
        echo "$(date "+%m%d%Y %T") : rdesktop is already running.  Existing this script" >> $Logfile
        exit 0
else
    echo "$(date "+%m%d%Y %T") : rdesktop has Stopped. Attempting to restart." >> $Logfile
    string=$(grep $ThisHost $ConfigFile)
    host=$(echo $string | awk  '{ print $1 }')
    ip_addr=$(echo $string | awk '{ print $2 }')
    userid=$(echo $string | awk '{ print $3 }')
    passwd=$(echo $string | awk '{ print $4 }')
    if [ "$ThisHost" == "${host}" ]
    then
        echo "$(date "+%m%d%Y %T") : Hostname $ThisHost  was found." >> $Logfile
        echo ". " >> $Logfile
        else
        echo "$(date "+%m%d%Y %T") : Hostname $ThisHost was not found. Please ensure your ComputerName has been set properly" >> $Logfile
        echo ". " >> $Logfile
        exit 0
        fi
    echo ${host} ${ip_addr} ${userid} ${passwd} $ThisHost
    rdesktop -z -f -u ${userid} -p ${passwd} ${ip_addr}
        exit 0
fi


Lastly I employ a cron job to run every two minutes and restart the rdesktop connection (essentially calling my WorkstationConnect.sh script). This ensure each raspberry pi thin client is always

connected to their assigned VM.

Code:
*/2 * * * * export DISPLAY=:0 nohup && ~/scripts/WorkstationConnect.sh &..~/scripts/cron.log

We setup each Pi Thin Client with a static IP and assign a Hostname (update /etc/hostname and /etc/hosts).

Hope this helps someone with their setup as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)