How do I email a remote computer IP to myself automatically?

Locked
Massive Quasars
Posts: 8696
Joined: Fri Dec 15, 2000 8:00 am

How do I email a remote computer IP to myself automatically?

Post by Massive Quasars »

I'd like to setup a remote computer that checks and emails it's IP periodically (everyday), what's the easiest way to go about doing this?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

`crontab -e` and add:

* 12 * * * ifconfig eth0 | perl -ne '/inet addr:([\d\.]*)/ && print $1' | mail -s "IP address" you@isp.com

That'll mail the IP address every day at noon (*NIX only, obviously).
Massive Quasars
Posts: 8696
Joined: Fri Dec 15, 2000 8:00 am

Post by Massive Quasars »

Thanks misantropia.

riddla could you expand on that.
Massive Quasars
Posts: 8696
Joined: Fri Dec 15, 2000 8:00 am

Post by Massive Quasars »

Sorted, thanks riddla.
User avatar
Foo
Posts: 13840
Joined: Thu Aug 03, 2000 7:00 am
Location: New Zealand

Re: How do I email a remote computer IP to myself automatically?

Post by Foo »

I had another idea also. Some home routers come with a feature to email the router log periodically. While the log usually won't contain the routers external IP, the email header will.

I was messing with my home router today then realised this was probably possible.
Massive Quasars
Posts: 8696
Joined: Fri Dec 15, 2000 8:00 am

Re: How do I email a remote computer IP to myself automatically?

Post by Massive Quasars »

After loading the DD-WRT firmware on my router, I found out that it supports many of these online services (DynDNS, No-IP, etc.). It can communicate the IP to these sites in place of a computer.

Good stuff.
Locked