Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.4: Easily wake a networked Mac via Automator Network
I've got my mini hooked up in one room to a TV. It doesn't really have easy access to a keyboard and mouse, but it is connected to a huge external hard drive that I store all sorts of files on. So sometimes, when the mini is asleep I need at the files. Searching on Google for "wake mac on lan" took me to this older hint, which hasn't had much action lately.

After trying the hints on that page, the problem was that after waking the mini, I would still have a terminal window open. Now there may be away around that, but I couldn't find one. So I took the information I learned there and plugged it into an Automator workflow, using the Automator: Run Shell Script action. The Shell should be /usr/bin/python, the Pass input should be to stdin, and the body of the script should be:
#!/usr/bin/env python
import socket
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto('xff'*6+'x00x11x22x33x44x5a'*16, ('192.168.1.255', 9))
You will have to replace the 00, 11, 22, 33, 44, 5a with your own mac address, of course -- you can find this in the Network System Preferences panel.

Then save the Automator action as an application or a Finder plug-in. When it is run, there is no Terminal window. (I saved mine as an application, changed the icon to a picture of a mini, and now I have an icon in my dock that, when clicked, wakes my mini in the other room).
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[7,369 views]  

10.4: Easily wake a networked Mac via Automator | 8 comments | Create New Account
Click here to return to the '10.4: Easily wake a networked Mac via Automator' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
WakeOnLan
Authored by: RickoKid on Wed, Oct 24 2007 at 8:04AM PDT
This is a great hint for a two Mac solution. If you need to wake/sleep more Macs (or just want a shiny GUI!) try WakeOnLAN.

BTW, I'm nothing to do with the project, just a satisifed user.

[ Reply to This | # ]
10.4: Easily wake a networked Mac via Automator
Authored by: i-scholar on Wed, Oct 24 2007 at 8:57AM PDT

Alternatively use the online command tool wakeonlan available both from Fink and Darwin Ports. It is indeed a Perl script.

You may also want to check sleepnow.



[ Reply to This | # ]
10.4: Easily wake a networked Mac via Automator
Authored by: adrianm on Wed, Oct 24 2007 at 11:41AM PDT
Pity these won't wake a Mac that's only connected via WiFi.

---
~/.sig: not found

[ Reply to This | # ]
10.4: Easily wake a networked Mac via Automator
Authored by: ctierney on Thu, Oct 25 2007 at 7:03AM PDT
Do you mean that airport cards are not "magic packet" aware?
That might explain why test on my home wifi didn't work.
--
Cole


[ Reply to This | # ]
10.4: Easily wake a networked Mac via Automator
Authored by: ctierney on Wed, Oct 24 2007 at 11:45AM PDT
Hello, For so reason the python script didn't work for me, but netcat did (not by broadcasting though):
#!/bin/sh

{ for (( i = 1; i <=  6; i++ )); do printf "\xff"; done
  for (( i = 1; i <= 16; i++ )); do printf "\x00\x11\x22\x33\x44\x5a"; done
} | nc -uw1 192.168.1.75 9
--
Cole

[ Reply to This | # ]
10.4: Easily wake a networked Mac via Automator
Authored by: mzs on Wed, Oct 24 2007 at 12:14PM PDT
Wait for 192.168.1.75 to not be in in your ARP table, then that will not work, hence the use of the broadcast.

[ Reply to This | # ]
10.4: Easily wake a networked Mac via Automator
Authored by: ctierney on Wed, Oct 24 2007 at 1:54PM PDT
The netcat solution doesn't work with broadcast. Maybe it something to do with my network at work. I'll try both the python and netcat version at home.
--
Cole


[ Reply to This | # ]
10.4: Easily wake a networked Mac via Automator
Authored by: ctierney on Wed, Oct 24 2007 at 3:38PM PDT
Still no go at home with either netcat or python. Cool hint, though! I'd love to get it working.
--
Cole


[ Reply to This | # ]