home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / autodial.zip / webip.cmd < prev   
OS/2 REXX Batch file  |  1997-05-22  |  6KB  |  153 lines

  1. /* WebIP -- a derivitive of: */
  2. /* REXX -- SENDIP.CMD Ver. 2.0
  3.  
  4.    Send dynamic IP via email to addressee of your choice.
  5.    Some ISP's allow you to keep a line up 24 hours/day with
  6.    the caviat that you drop the line at least once in that
  7.    period -- this prog allows that to happen while keeping you
  8.    advised of the new IP on reconnecting so you can always reach
  9.    your private site from work or school or where ever.
  10.  
  11.    Run this from a cron job once a day or however often your ISP
  12.    requires.
  13.  
  14.    From: Dennis Peterson
  15.    Free to the world
  16. */
  17.  
  18. /* The method of finding the IP addres was enhanced to allow the address
  19.    to be found, even if multiple TCP/IP interfaces are used. However,
  20.    the hostanme may be blank or possibly incorrect when multiple
  21.    interfaces are used. Best to use the IP address.
  22.  
  23.    The interface must now be specified. The defaut is the first PPP
  24.    connection. See the bottom of the section the user (you) must fill
  25.    out below.
  26.  
  27.    I have altered SendIP to create a short web page with links to your
  28.    current IP address and FTP the file to another server (presumably your
  29.    ISP's server).
  30.  
  31.    Change done by Jeff Jackowski (jeffj@ro.com, http://ro.com/~jeffj)
  32. */
  33.  
  34. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  35. Call SysLoadFuncs
  36. Call RxFuncAdd 'FtpLoadFuncs','rxFtp','FtpLoadFuncs'
  37. Call FtpLoadFuncs
  38.  
  39. Signal On Halt Name CLEANUP
  40.  
  41. /* Use your favorite means to restart your PPP/SLIP session */
  42. /* 'restart_PPP' */
  43.  
  44. /********************************************
  45.  *
  46.  *                  NOTE: 
  47.  *     You MUST fill in the following entries
  48.  *
  49.  ********************************************/
  50.  
  51. /* Enter your timezone - default is for left coast, USA */
  52. TZ = "CST"
  53.  
  54. /* Set the administrator's name and email address.                    */
  55. /* Used to make a link to let users easily send email about problems. */
  56. AdminName = "Administrator"
  57. AdminEmail = "admin@zuse.olympus.gov"
  58.  
  59. /* FTP Upload location -- where to load the web page on your other server
  60.    (ISP) */
  61. FTPUploadLoc = "public_html"  /* common for ISP's using UNIX, may also */
  62.                               /* specify directories under this one,   */
  63.                               /* but be sure to use a slash, and the   */
  64.                               /* correct case!                         */
  65.                               /* ex: "public_html/adirectory/here"     */
  66. FTPUploadFile = "door.html"   /* the name to give the web page with the IP */
  67. FTPUploadSite = "here.com"    /* FTP site to upload the page to        */
  68. FTPUser       = "me"          /* your username for FTP access          */
  69. FTPPassword   = "password"    /* your password for the FTP account     */
  70.  
  71. /* Define links */
  72. /* WebLink is the page to link to on the web server running on your
  73.    computer. The IP address is filled in dynamically */
  74. WebLink = "index.html"
  75. /* FTPLink works the same way. Be sure the given directory is valid
  76.    for the anonymous account on your server. */
  77. FTPLink = "pub"
  78.  
  79. /* Define the background to use on the web page */
  80. BackgroundImage = "plaster.gif"
  81.  
  82. /* Tell it what device to use. ppp0 is the first PPP connection, sl0 is
  83.    the first SLIP connection, lan0 is the first LAN/ethernet connection.
  84.    For the second connection, use the number 1 instead of 0   */
  85.  
  86. INetDevice = 'ppp0'
  87.  
  88. /******************************************
  89.  *
  90.  *     No user-defined variables below here
  91.  *
  92. ******************************************/
  93.  
  94. Outfile = 'new_ip.fil'
  95. Call SysFileDelete Outfile
  96.  
  97. /* let's create a queue for the new IP */
  98. newq = RxQueue("create")
  99. Call RxQueue 'set', newq
  100.  
  101. /* The method of finding the IP addres was enhanced to allow the address
  102.    to be found, even if multiple TCP/IP interfaces are used.
  103. */
  104.  
  105. '@ifconfig' INetDevice '| RxQueue' newq
  106. Parse Pull interfacename flags
  107. Parse Pull dumb inet IP extra
  108.  
  109. /* Now flush the queue */
  110. Do While Queued() > 0
  111.    Parse Pull .
  112. end
  113.  
  114. /* now get the time and date */
  115. Parse Value Date() With Today Month Year
  116. Day = Left(Date('W'),3)
  117. Year = Right(Year,4)
  118. Parse Value Time('L') With Hour':'Minutes':'Seconds'.'Hundredths
  119.     /* comment out the next line to prevent an http link */ 
  120.  
  121. Message =  '<HTML><HEAD><TITLE>WebIP</TITLE></HEAD><BODY background = "' ||,
  122.            BackgroundImage || '">' ||,
  123.            '<H2><I>WebIP</I></H2>' ||,
  124.            'The last known IP address of the computer you are trying to' ||,
  125.            ' reach is ' || IP ||,
  126.            '<P><H3>Select a method of communication:</H3><UL>' ||,
  127.            '<LI><A HREF="http://' || IP ||'/' || WebLink || '">Web (HTTP)</A>' ||,
  128.            '<LI><A HREF="ftp://' || IP ||'/' || FTPLink || '">FTP</A>' ||,
  129.            '<LI><A HREF="telnet://' || IP || '">Telnet</A>' ||,
  130.            '</UL>Last updated: '|| Left(Date('W'),3) ||', '||,
  131.            Today Month Year || ', ' || Hour || ':' || Minutes || ':' ||,
  132.            Seconds || ' ' || TZ || '<P><HR>' ||,
  133.            'If you are having trouble, first read ' ||,
  134.            '<A HREF="WebIPfaq.html">the FAQ</A>. If it doesn''t help, then ' ||,
  135.            'contact <A HREF="mailto:' || AdminEmail || '">' || AdminName ||,
  136.            '</A> for futher assistance</BODY></HTML>'
  137.  
  138. Call Lineout Outfile, Message
  139. Call Lineout Outfile
  140.  
  141. /* now send it off */
  142. call FtpSetUser FTPUploadSite, FTPUser, FTPPassword
  143. call FtpChDir FTPUploadLoc
  144. call FtpPut Outfile, FTPUploadFile
  145. call FtpLogoff
  146. call FtpDropFuncs
  147.  
  148. say 'Sent WebIP web page to server'
  149.  
  150. CLEANUP:
  151.    Call RXQueue "delete", newq
  152.    Exit  /* Rexx */
  153.