On Wed, May 03, 2000 at 04:30:16PM +0800, Corey Popelier wrote: > Heres the deal - I dial into my ISP, and get allocated a random IP > address, ie. I do not have a static IP, and cannot obtain one with my > current ISP. > > What I would like to do, is on dialing in, pipe my ifconfig ppp0 to a > file, and mail that to my work address as follows: > > ifconfig ppp0 > ipaddy > mail -s IP [EMAIL PROTECTED] < ipaddy > > Doing this, according to my sendmail logs, generates a Data Format > Error. Any way I can achieve this using the above approach, or is there a > better alternative I am not aware of?
I did something similar, with a check for the time of day and weekday. Then I put it in /etc/ppp/ip-up.d. I'm a lousy shell scripter, but this works: ------------------------------------------------------- #!/bin/sh DAY=`date +%w` HOUR=`date +%H` if test "$DAY" -gt 0 -a "$DAY" -lt 6 -a "$HOUR" -gt 7 -a "$HOUR" -lt 17 then /sbin/ifconfig ppp0 | mail -s IP [EMAIL PROTECTED] fi ------------------------------------------------------ With the "persist" option to ppp, if the link goes down, it'll get restarted, and you'll get a new mail at work with the IP address. You can use a cron job to start/stop the link during working hours. I used to use this for transferring files until I hijacked an unused Jaz drive (my work doesn't provide any remote access 'cause the IT management is lame.) If you want to be tricky, you can parse the IP address first. More trouble than it's worth, IMHO. -- ¶ One·should·only·use·the·ASCII·characterset·when·compos » ing·email·messages.