home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
sendip21.zip
/
sendip.cmd
next >
Wrap
OS/2 REXX Batch file
|
1996-12-08
|
4KB
|
121 lines
/* REXX -- SENDIP.CMD Ver. 2.0
Send dynamic IP via email to addressee of your choice.
Some ISP's allow you to keep a line up 24 hours/day with
the caviat that you drop the line at least once in that
period -- this prog allows that to happen while keeping you
advised of the new IP on reconnecting so you can always reach
your private site from work or school or where ever.
Run this from a cron job once a day or however often your ISP
requires.
From: Dennis Peterson
Free to the world
*/
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs
Signal On Halt Name CLEANUP
/* Use your favorite means to restart your PPP/SLIP session */
/* 'restart_PPP' */
CRLF='0d0a'x
/********************************************
*
* NOTE:
* You MUST fill in the following entries
*
********************************************/
/* Enter any comments you wish to have placed in the body of the message.
This text will be placed following the host name and IP information.
If you wish to have no comments then leave this blank.
e.g. Comments = ""
*/
Comments = 'http://www.visit_me.edu'
/* Enter your timezone - default is for left coast, USA */
TZ = "PST8PDT"
/* set up the address lists
e.g. From = 'slickwilly@whitehouse.gov (Slick Willy)' || CRLF
*/
From = "your_name@domain.com (First Last)" || CRLF
Reply_to = "your_name@domain.com (First Last)" || CRLF
/* Build list of recipients. Add any number of names to CC list. Separate
names with a comma character.
e.g.: CC = "meatball@hoser.com,wahoo@mindless.com,hairball@cathouse.com"
*/
To = "some_name@some_domain.com" || CRLF
CC = "another_name@some_domain.com" /* do not add CRLF to this line */
Subject = "Today's New IP" || CRLF || CRLF
/******************************************
*
* No user-defined variables below here
*
******************************************/
Outfile = 'new_ip.fil'
Call SysFileDelete Outfile
/* let's create a queue for the new IP */
newq = RxQueue("create")
Call RxQueue 'set', newq
/* Now get the host name and IP and put them in the queue.
Use OS/2's hostname.exe to get host name and ping.exe to
get the IP. Can also use netstat.exe and a different parsing
template if you have a netcard and a tcp/ip network installed.
*/
'@hostname | RxQueue' newq
Parse Pull Host_Name
'@ping' Host_Name '1 1 | RxQueue' newq
/* remove unneeded line from queue then get the IP */
Pull .
Parse Pull . 'bytes from ' IP ':' .
/* Now flush the queue */
Do While Queued() > 0
Parse Pull .
end
/* now get the time and date and bundle all the header info into
an RFC822 format for sendmail
*/
Parse Value Date() With Today Month Year
Day = Left(Date('W'),3)
Year = Right(Year,2)
Parse Value Time('L') With Hour':'Minutes':'Seconds'.'Hundredths
Message = 'Date: '|| Left(Date('W'),3) ||', '||,
Today Month Year Hour || ':' || Minutes || ':' ||,
Seconds || ':' ||,
Left(Hundredths,2) TZ || CRLF ||,
'From: ' || From ||,
'Reply-to: ' || Reply_to ||,
'To: ' || To ||,
'CC: ' || CC || CRLF ||,
'Subject: ' || Subject ||,
'Host name =' Host_Name || CRLF ||,
'IP =' IP || CRLF || CRLF ||,
Comments
Call Lineout Outfile, Message
Call Lineout Outfile
/* now send it off */
'sendmail -t -a' Outfile
CLEANUP:
Call RXQueue "delete", newq
Exit /* Rexx */