custom applescript for external ip address

Discussion in 'macOS' started by innominato5090, Oct 25, 2009.

  1. innominato5090 macrumors 6502

    innominato5090

    Joined:
    Sep 4, 2009
    #1
    hi guys! hope I've chosen the right section to start this new thread.
    I'm looking for a solution to save the external ip address into a file on my dropbox folder, so I can easily read it from my MacBook when I'm not at home or on my iPhone and access via VNC to my Mac at home.
    I think that an applescript that runs in background and constantly update the ip (like every hour) should be the right solution but I can't figure how to create it! I'm quite a dumb with apple script editor, so an help would be highly appreciated! :D

    Luca
     
  2. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #2
    How about registering for a free account from DynDNS.org? Then you just run a client and you can get something like:

    <yourname>.dyndns.org
    <yourname>.homeunix.com

    You can replace <yourname> with anything you want, so long as nobody else is using it.
     
  3. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #3
    I don't think that updates when your IP changes. So it'll break.

    I've actually thought of this. But I haven't been able to successfully upload data to my webhost via ftp in terminal.

    In any case, I'll post the method in the hopes someone will help both of us out: THIS IS NOT A SOLUTION (yet)

    You can either run a chron job in terminal OR download NerdTool here. Open it, and create a new shell item.

    In that shell item you wil need to have the script for: writing a file of your ip to somewhere (hidden)

    Code:
    curl --silent www.whatismyip.com/automation/n09230945.asp > /tmp/myip
    will grab your IP and store it in plain text.

    Now you could also include it to only update and upload when it's different.

    This is where someone comes in and tells us how to use ftp in the shell to upload to a protected directory.
     
  4. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #4
    Well, if you check out the site, it explains what it does (dynamic DNS). You have a client on the inside network updating the DNS entry, so it is updated whenever the IP changes. I do this all the time.

    Don't re-invent the wheel. A hostname is much easier to remember than constantly having to check the IP.
     
  5. innominato5090 thread starter macrumors 6502

    innominato5090

    Joined:
    Sep 4, 2009
    #5
    that's a fantastic idea! actually my netgear that i use as modem (connected with my time capsule) has built-in dyndns support!
    I'll will try later, thank you very much!
     
  6. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #6
    You're welcome. FYI, don't have the built-in client update too often or they will disable your account. You just need to email them to re-enable, but just something to keep in mind.

    My Linksys running OpenWRT has the built-in client too and it works fine.
     

Share This Page