#!/bin/bash
# remote script to find the servers IP address
# and create a ssh VNC session 
cd ~
rm -f call-home
wget ftp://mcdonars:xxxx@64.156.241.133/call-home
MIPaddr=`cat ~/call-home`
#check for a running ssh process
CHECK=`ps -U $USER | grep ssh\ $MIPaddr`
if [ -n "$CHECK" ]; then
         vncviewer localhost:1
	else	 
         ssh -i $HOME/.ssh/id_rsa -T -L 5901:127.0.0.1:5901 -C -N
$MIPaddr 
         vncviewer localhost:1
fi