I'm still working on my script. So far I've got it working where it reads the hostname and finds the IP to use based on the case statement. This is what I have so far.
# Check if rdesktop is running
read var < ipfile
if pgrep rdesktop > /dev/null
echo "$(date "+%m%d%Y %T") : rdesktop is already running." >> $LOGFILE$
echo "$(date "+%m%d%Y %T") : rdesktop has Stopped. Attempting to resta$
case $THISHOST in
(rpiA) rdesktop -z -u user -p password 10.100.100.10;;
(rpiB) rdesktop -z -u user -p password 10.100.100.11;;
(rpiC) rdesktop -z -u user -p password 10.100.100.12;;
Right now my code is not using the line: read var < ipfile
But I would like list all my server IP's in the ipfile like this:
And then modify my code to reference the variables in ipfile in my script.