Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible.....

Status
Not open for further replies.

fenris

Programmer
May 20, 1999
824
CA
I would like to be able to run apache on my linux box. This I can do, unfortunately I am on ADSL and the ip changes quite often. I am wondering if I could setup another mail account or perhaps use my current one and scan the subject line for a specfic phrase like "give me your IP now!" and the linux box would scan the new mail on the server for one containing that particular subject line and download it. From there it would formulate a responding email with the current ip address of the machine and send the email to the person who sent it.

Is this crazy....or can it be done....
 
I assume you have some kind of loggin of your connection, something like /var/log/ppp0-log or whatever. What I'm getting at is maybe writing a script that parses the IP out of your connection log and passes it to Apache. I don't know how this works because I don't use ADSL, just an idea. Hope it helps.
 
If I understand correctly what you are saying is, if someone wants to connect to my web server, how can I automatically tell them my new IP address?

You could use something like Majordomo to ezmlm to set up a mailing list for people would need to know. Then do what Jon suggested and scan your logs for your IP address on a regular basis. (Alternativley, you could use "ifconfig -a" and grab the required information from there.) Then, if your IP address has changed, send a mail to your mailing list to say so.

One other thing that may be of interest - I have heard of companies that will host your domain name, and will redirect web requests to your web server when it is on-line. This type of service was created for people who wanted to run their own web server over a dial-up type connection. Sorry, though, I don't know of any links to this kind of service provider, although a search in the usual places should give some results.

HTH.
 
Jon and Andy, thanks for the tip I really liked Andy's tip about using major domo to email the people that need to know. That is what I was looking for. FYI the ADSL that I am using requires pppoe and I use roaring penguin to facilitate the connection (it works great!!) and if you use ifconfig the external ip address doesn't show up. You have to use the script provided by RP, namely adsl-status and it returns the ip address amoung other information.

Where would I find information about major domo and how to set it up? Also, to parse the output and get it to major domo what would be the best solution. For my self I would use java to accomplish this as I am not very familiar with perl or shell scripting.

This is my understanding of what I need to do:
1) write a program (java, perl or shell script) to parse the information from adsl-status
2)write a small script that when run executes 1) and places the properly formated output into a text file
3) some how get major domo to send this out
4) put 2) into a cron job


well 4) leads me to another question, what would be the best way to compile statistics on how offten my ip would change? I am think that I could use 2) and send the ip along with the date to a log file and after awhile analyze the log file.

BTW Andy I am familiar with services like dynip where they monitor your ip and provide you with a domain name that automatically forward traffice to a dynamic ip. I am cheap and would rather learn how to do it myself. The whole idea behind this is that I can add my own hotmail account to the list and from there beable to use the webserver for development, even when I am on the road. So it would not make sense for me to pay and extra fee on top of the ADSL for something that will only be used by myself.

Thanks for the input, I appreciate it....
 
You can get majordomo, and info about it, from
I've never set it up myself, but it has a good reputation, and lot's of major mailing lists use it. As far as making announcements goes, I think that all you would have to do is mail the formatted text file that you create to "my_mailing_list_name@localhost". Once you do that, majordomo passes it on to all the members of the mailing list, including your web mail account.

On the coding side of things, I think you are taking the right approach, although I might be tempted to (1) and (2) into the same program. Using perl, awk, or sed to grab the IP address from "adsl-status" should be fairly trivial.

Think along the lines of "IP_ADDRESS=`adsl-status | grep ip_address_pattern | awk 'print $3'`" and you won't be too far off. You'll need to check whether $3 in the awk bit is actually the IP address in the adsl-status output, though ;^ Once you have $IP_ADDRESS, you can mail it out pretty easily:
[tt]
echo | mailx -s &quot;My server IP address has changed&quot; my_mailing_list@localhost <<End_Of_Mail

Hi there!

My IP address has changed to $IP_ADDRESS

Thanks!
End_Of_Mail
[/tt]

Hope this helps a little!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top