Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Wake a sleeping Mac with via Automator System 10.5
I have a Mac mini in my living room hooked up to my TV. I wanted to be able to control the mini from my iMac in my office. Using Screen Sharing built into Leopard, it's a simple click of the mouse to do this. With a little Automator love, I created a simple workflow that turns the Screen Sharing step into a click of an icon in the dock.

However, even with the power efficiency of the 2009 Mac mini, I don't want to leave it on 24/7. After searching through several solutions that used Python and shell scripting (neither of which I know or could make work), I found this nifty Applescript from Mark Muir that I adapted to solve my problem. Here's my modified code:
(*
Script adapted from Wake on WAN - by Mark Muir (2008-04-01)
http://forums.dealmac.com/read.php?4,2751523
*)

property MAC_address : "00:25:4b:9f:63:c8"
property WAN_IP_address : "255.255.255.255"

on run
	set command to "/usr/bin/php -r " & quoted form of ("$mac = " & quoted form of MAC_address & "; $ip = " & quoted form of WAN_IP_address & "; " & "
$mac_bytes = explode(\":\", $mac);
$mac_addr = \"\";
for ($i=0; $i<6; $i++)
$mac_addr .= chr(hexdec($mac_bytes[$i]));
$packet = \"\";
for ($i=0; $i<6; $i++)	/*6x 0xFF*/
$packet .= chr(255);
for ($i=0; $i<16; $i++)	/*16x MAC address*/
$packet .= $mac_addr;

$port = 9;
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, TRUE);
socket_sendto($sock, $packet, strlen($packet), 0, $ip, $port);
socket_close($sock);
")
	do shell script command
end run
You'll need to replace the MAC_address property with the MAC address (found in the Networking System Preferences panel) of the machine you'd like to wake. I then wrapped this script in a simple Automator application to make it a true one-click operation. You can read all the details, and download a copy of the Automator application, in this entry in my blog.

[robg adds: I've mirrored the Automator application here on Mac OS X Hints, in case the original post ever goes away. While I haven't tested this one, I'm pretty sure you could replace the full script shown above with a call to the free Wakeonlan perl script, which was described in this older hint.]
    •    
  • Currently 1.71 / 5
  You rated: 2 / 5 (7 votes cast)
 
[10,586 views]  

10.5: Wake a sleeping Mac with via Automator | 5 comments | Create New Account
Click here to return to the '10.5: Wake a sleeping Mac with via Automator' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Wake a sleeping Mac with via Automator
Authored by: Dr. T on Jul 02, '09 09:43:53AM
The freeware utility Wake550 can do this. I activate it with a QuicKeys shortcut that enters the info on the Mac I wish to wake.

http://www.tc.umn.edu/~olve0003/wake550.html

[ Reply to This | # ]
10.5: Wake a sleeping Mac with via Automator
Authored by: hypert on Jul 02, '09 09:56:38AM
If you're lucky enough to have an iPod touch or an iPhone, you can use the iWOL app. It's $3, and the well-worth it for iPod/iPhone users. Plus, then you can control iTunes on the Mac mini using the free Remote app. I don't have a Mac mini, but I wake my G4 MDD and stream music thru AirTunes this way. It's also nice to have a "sleep" script that you can run to put the machine to sleep too.

[ Reply to This | # ]
RemoteBoot Lite
Authored by: sjk on Jul 03, '09 03:20:32PM

RemoteBoot Lite is a free alternative to iWOL for the iPhone / iPod touch that I'm currently using.



[ Reply to This | # ]
10.5: Wake a sleeping Mac with via Automator
Authored by: robogobo on Jul 03, '09 10:15:54AM

Also, SleepOver works quite well on the iPhone.



[ Reply to This | # ]
10.5: Wake a sleeping Mac with via Automator
Authored by: somynonami on Jul 26, '09 11:54:05AM

Do any of these hints work over a VPN? I've given my users the ability to control their work machines from home via Screen Sharing.app but it currently means we can't sleep the machines.



[ Reply to This | # ]