10.4: Retrieve WAN IP via script and Automator

Jun 07, '06 07:30:00AM

Contributed by: scmckenzie

I often access my G5 and my home network at large from the office. The problem is my bad connection, NAT, and not having a static IP. It's usually good enough that I only have to check my WAN IP address once a day. The problem is I'm going on vacation for a while, and would like to be able to 'check in.' So, between my abysmal scripting and Automator skills, I think I've got something worked out.

So, the first thing is a bash script that goes out to the web and gets the IP address of the machine it's running on. If things worked, it will print a message saying:

Here's the current IP Information for DuoBook

XX.XX.XX.XX
As far as I can tell everything ran fine.
Next, I compiled an Automator workflow (download) into an application to email me that output, and clean up the temp files. It's running in a cron job.

It seems to be running fine, although, like I said my scripting / Automator skills are terrible, so it could break. If anyone sees anything wrong, could you let me know before I leave for that vacation. You'll have to tweak the workflow, as it's got my email built in, and it relies on knowing where the script is.

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060602180942480