My computer is one of three computer on our LAN. Our router is a Time Capsule. My computer is the only of of three computers that has been assigned a static IP address on the LAN, because it runs an Apache installation. I tinker around with web development from time to time, and I wanted to be able to demo my experiments to my friends without having to throw it on a flash drive.
My home computer doesn't have a domain name, of course. I access it with my IP address, which is dynamic, and changes whenever the cats dislodge the modem.
I'm trying to write a script that checks my external IP (there's only one, we don't have aliases or multiple routers or anything), and compares to the IP in a saved file. If it finds that the IP address it detected is different from the one in the file, it sends me an email and saves the new IP to the file, where it check it later on.
- The script is called by launchd every 5 minutes.
- The script checks my external IP.
- It compares it to the IP in its save file.
- If the IP is the same as the IP in the save file, the script quits.
- If the IP is different, the script activates another program that sends me an email.
- I recieve the email and can refer to IP address by looking at the message's header.
I'm new to UNIX, but not totally clueless. I can move around in my computer, move, copy, and delete files, ping servers, and other basic tasks. I usually learn a new command on my own, but in this case, ifconfig (which I think I need) is just way out of my league. Can anyone help?