Results 1 to 6 of 6
  1. #1

    Member Since
    Mar 14, 2009
    AppleScript to check IP of local Machine then Backup

    My MBP is on multiple networks everyday for work and i'd like a script that checks the IP address of my MBP (wireless & wired) and if in a certain subnet, initiate a backup. I have an applescript that mounts my NAS however it would be good to have something that first checks the network i'm on, if home then mount my NAS and run a backup.

    Thanks in advance for your help.


  2. #2

    xstep's Avatar
    Member Since
    Jun 25, 2005
    On the road
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    Let me google that for you. This was the first hit.

    You may want to choose en1 instead of en0 if you are using wireless. Or test for both.
    CameraTime - Time lapse photography for novice and advanced users.

    When asking questions, post the version of your software. You'll receive better answers.

    Please post your results to the thread as it is good feedback.

  3. #3

    Member Since
    Mar 14, 2009
    I can do a "ifconfig en0" to get the details of the interface, i'm curious how i can store and present the 'inet' value, which is the IP Address, as a variable which i can then use later in another script?

  4. #4

    Member Since
    Mar 16, 2009
    Use the "set" command, for example:

    set ipaddress to do shell script "ifconfig en1 | grep 'inet' | awk '{print $2}'"

    Once you have this done, you can use it in same script.

  5. #5

    Member Since
    Mar 14, 2009
    Thanks Talcon, is there a way to specifically only print the IP address, i received this when ran:

    Mac Specs: Macbook Pro 2.6 Core 2 Duo, 4GB ram, 160Gb HDD

  6. #6

    Member Since
    Mar 14, 2009
    Found it:

    ifconfig en0|grep "inet "|cut -d ' ' -f 2
    Mac Specs: Macbook Pro 2.6 Core 2 Duo, 4GB ram, 160Gb HDD

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 06-16-2015, 12:29 PM
  2. how to remove a local encrypted backup of iphone
    By sullij in forum iPhone Hardware and Accessories
    Replies: 5
    Last Post: 12-05-2014, 02:59 PM
  3. local backup of Gmail without using POP?
    By mmwwah in forum macOS - Apps and Games
    Replies: 3
    Last Post: 08-07-2011, 03:34 PM
  4. PHP on Local Machine
    By iRock in forum Web Design and Hosting
    Replies: 30
    Last Post: 07-18-2007, 02:03 AM
  5. Backup Files From Server to Local Drive
    By rschumaker in forum macOS - Apps and Games
    Replies: 0
    Last Post: 04-14-2007, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts