Hi! I'm Robby.

Robby Grossman

I blog about technology and startups.

I work full time as an engineer at oneforty. I also maintain wordpress plugins like ArtPal and Smuggery. When there is no keyboard in front of me, I make music and take pictures.

05 September 2009 ~ View Comments

Use Time Machine with Wake on LAN to Enable Network Backups to Sleeping Devices

Update Sept 6, 2009: I’ve created a project at github to simplify this process. More details here.

Task: You want to use Time Machine wirelessly to backup your Mac to a drive on another Mac on your network.

Problem: If the target machine is in “sleep” mode, your backup will fail.

Solution: Send a “magic packet” to the target machine to wake it up if it’s sleeping.

Gotcha: New Macs support WOL via Airport. However if you’re using an older Mac, the target machine must be connected via ethernet (the machine you’re backing up can still be connected via wifi).

Let’s roll:

Prep the Target Machine

The target machine is the Mac that will hold your backups.

  1. On the target machine, go to System Preferences and open the “Energy Saver” panel.
  2. Configure sleep settings as desired
  3. Be sure to check the “Wake for Ethernet network access” box at the bottom.
  4. Close out of system preferences.
  5. Open System Profiler from your Utilities directory in Applications.
  6. Click “Network” in the left panel.
  7. Click “Ethernet” in the top panel.
  8. In the bottom panel, scroll down until you see “Ethernet:” with a line under it showing something like “MAC Address 00:15:d4:a3:cf:1b”. Write down this 12-digit MAC address.
  9. Exit System Profiler

Configure the Host Machine

The host machine is the Mac that you will be backing up.

  1. On the host machine, install MacPorts if you haven’t already.
  2. Open up a Terminal from your Utilities directory in Applications.
  3. Type: “sudo port install wakeonlan” and press return.
  4. Enter your password when prompted, and wait while MacPorts installs the utility and its dependencies.
  5. Open Automator in Applications.
  6. Create a new “Application” workflow when prompted.
  7. Double-click the “Run Shell Script” library item on the left. In the box that appears, erase “cat” and instead type:
    macaddress="00:00:00:00:00:00"
    while true
    do
    	results=`syslog -k Sender com.apple.backupd -k Time gt -10s -k Message Seq 'Starting standard backup'`
    	if [ -n "$results" ]
    	then
    		/opt/local/bin/wakeonlan "$macaddress"
    		while [ -n "$results" ]
    		do
    			sleep 10
    			results=`syslog -k Sender com.apple.backupd -k Time gt -10s -k Message Seq 'Starting standard backup'`
    		done
    	fi
    	sleep 10
    done
  8. In the first line, replace the 00:00:00:00:00:00 with the MAC Address that you wrote down earlier. Be sure to keep the quotes.
  9. Choose File > Save As…, and name it “WOL Daemon” in the Applications folder when prompted.
  10. Exit Automator.
  11. Go to System Preferences and open the “Accounts” panel.
  12. Click “Login Items” at the top.
  13. Click the + icon to add a new one.
  14. Select the WOL Daemon that you just created, and check the box next to it marked “Hide”.
  15. Restart your computer, and voilà, your target machine will now be woken up if it’s asleep while Time Machine runs.
Share with Others
  • Twitter
  • Facebook
  • del.icio.us
  • Print
  • email

View Comments to “Use Time Machine with Wake on LAN to Enable Network Backups to Sleeping Devices”

  1. wackazong 17 November 2009 at 3:36 am Permalink

    Should’t the second results= search for a line that contains the “Ejected Time machine Volume” message?

  2. wackazong 17 November 2009 at 4:37 pm Permalink

    syslog is such a terrible (i.e. 99%) CPU hog. I finally ended up with this script. Same function, less hassle.


    #!/bin/bash

    macaddress="00:26:08:f5:84:53"
    while true
    do
    results=$(grep backupd /var/log/system.log | tail -n 3 | grep Starting\ standard\ backup)
    if [ -n "$results" ]
    then
    Echo Found Time Machine Start, sending WOL packet
    /opt/local/bin/wakeonlan "$macaddress" &
    fi
    sleep 10
    done

  3. Robby Grossman 17 November 2009 at 4:46 pm Permalink

    Hey,

    Thanks for the improvement. I will update the code over at github (unless you have an account in which I can pull your fork).

    –Robby


Leave a Reply

blog comments powered by Disqus