another new script for tunneling. starting to achieve critical mass for
[feisty_meow.git] / scripts / security / tell_zooty_our_ip.sh
index 3d3764aa57e28863f0ef829e6730fb04495464d2..5e8aa2e63ccc0eedcff7b0d3df7074c1f47c97ab 100644 (file)
@@ -10,39 +10,37 @@ username=fred
 local_user=fred
 tempdir=/tmp  # where we generate our files.
 
-source $HOME/yeti/scripts/core/launch_feisty_meow.sh
+source $HOME/feisty_meow/scripts/core/launch_feisty_meow.sh
 
 soundfile=$FEISTY_MEOW_DIR/database/sounds/woouoo.wav
 if [ ! -z "$1" ]; then
   soundfile=$1
 fi
 
-ip_file="$(mktemp ${tempdir}/$(hostname | sed -e "s/\..*$//")_ip.XXXXXX)_${USER}"
+ip_file="$(mktemp ${tempdir}/ip_${USER}_$(hostname | sed -e "s/\..*$//").XXXXXX)"
 
-# iterate forever, since we want to keep running this.
-while true; do
+# get live ip address
+pushd $tempdir
+wget http://automation.whatismyip.com/n09230945.asp -O "$ip_file" 
 
-  # get live ip address
-  pushd $tempdir
-  wget http://automation.whatismyip.com/n09230945.asp -O "$ip_file" 
+chmod 644 "$ip_file"
+my_ip=$(head "$ip_file")
 
-  chmod 644 "$ip_file"
-  my_ip=$(head "$ip_file")
+echo "my ip is [$my_ip]"
 
-  echo "my ip is [$my_ip]"
-
-  # send the file over to the server.
-  # note that the local_user here is expected to have a certificate that
-  # gets us access to the server.  this needs to be on the local machine
-  # for sftp to run without a login prompt.
-  sudo -u $local_user sftp $username@$server <<eof
-mkdir gen
+# send the file over to the server.
+# note that the local_user here is expected to have a certificate that
+# gets us access to the server.  this needs to be on the local machine
+# for sftp to run without a login prompt.
+sudo -u $local_user sftp $username@$server <<eof
+if [ ! -d gen ]; then
+  mkdir gen
+fi
 cd gen
 put $ip_file $(hostname | sed -e "s/\..*$//")_ip.txt
 eof
 
-  popd
+\rm -f "$ip_file"
 
-  sleep 600
-done
+popd