Make your own free website on Tripod.com

Those of us who choose to run our own web servers behind our ISPs (with DHCP) share the problem of not being able to predict what our I/P address will be after a reboot. I solved this problem with a little REXX code snippet which I offer here to the general public.

To run this code you would need to obtain and install IBM Object REXX For Linux (free!). But you could always code up your own solution in your favorite language using this as a guide.

What this does is:

  1. Obtains your I/P address...
  2. Packs it into some re-direct HTML code...
  3. Uploads it to a static web site somewhere.

Here is the REXX source.

- - - - - - - - - - - - - - - - - - /* Create some re-direct HTML code and upload to Tripod.... KDJ */ /* define constants */ pumpout = '/tmp/pump.out' html1 = '<html><head><meta http-equiv=\"refresh\" content=\"0; url=http://' html2 = '/\"></head><body><a href=\"http://' html3 = '/\">click here for My Server</a></body></html>' /* get my current I/P from PUMP into a file */ 'pump -s >'pumpout /* read; discard the first record and get the 2nd */ rec = linein(pumpout) rec = linein(pumpout) /* parse out the second token = I/P */ parse var rec . ip /* write out the HTML file */ 'echo "'html1||ip||html2||ip||html3'" >/tmp/redirect.html' /* transfer it to Tripod... see ~.netrc for FTP Batch stuff */ 'ftp ftp.tripod.com' exit - - - - - - - - - - - - - - - - - -

If you want this to run unattended, such as right after you boot, you will need to put a .netrc file in your home directory. This file holds your FTP userid and password, and contains a small macro which performs the upload.

Here is a sample .netrc file...

- - - - - - - - - - - - - - - - - - machine ftp.tripod.com login myuserid password mypassword macdef init bin put /tmp/redirect.html redirect.html close quit - - - - - - - - - - - - - - - - - -

BE SURE to put a blank line at the bottom of this file, or the macro will complain.

Now, just put a link on your home page, like:

<a href=redirect.html>Here's My Personal Server!</a> and away you go. Click on the link and you are there.

Have Fun!

K.