The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 02-27-2007
heith's Avatar
heith heith is offline
Registered User
 

Join Date: Feb 2007
Location: Michigan, USA
Posts: 3
The Script...

ok, I don't think I explained it well enough.

I think it will be easier if I just paste the script... then you can pick it apart.

Code:
#!/bin/bash
BASEDIR=~/scripts/fsip	##The name of the folder you keep all your text files 
NEWIP=$BASEDIR/newip	##Location of the text file that will store the address of the CLIENT
SERVER=example.com       		##Name of the server that hosts the IP   	
RHOME=/home/fsip/ 	##Target Directory on the server (the location of the SERVER script)   	
GETIP=example2.com/ip		##The server[s] that send back the Clients public IP. (calls a webpage with this php code: <?php echo $_SERVER['REMOTE_ADDR']; ?>)
PUBIP=`lynx -dump $GETIP`	##Getting the CLIENT's current ip address  (of course this requires lynx... elinks should work too)
#-----------------------------------------------------------------------------------------------
if [ "$PUBIP" != "$NEWIP" ]; then
echo $PUBIP > $NEWIP
scp $NEWIP $SERVER:$RHOME/`hostname`-ip.txt
fi
---------------EDIT------------------

If anyone cares... (which I doubt because no one took the time to respond) I
came up with a better solution with the help of a php guru.

If you interested in a fake static IP, email me.

Last edited by heith; 03-02-2007 at 07:41 AM.. Reason: typo
Reply With Quote