I spent a while trying find out how to get my AppleTV to wake up my server from suspension when it boots. It turns out that it is pretty straightforward. This assumes that you server is Wake on Lan enabled.
1) First you need you need to follow the instructions on this wiki to install Python. This might seem complicated but if you follow them it will work.
2) You need to make a file somewhere on you PC and cut and paste this code into it:
import struct, socket def wakeonlan(ethernet_address): *# construct a six-byte hardware address *addr_byte = ethernet_address.split(':') *hw_addr = struct.pack('bbbbbb', int(addr_byte, 16), * *int(addr_byte, 16), * *int(addr_byte, 16), * *int(addr_byte, 16), * *int(addr_byte, 16), * *int(addr_byte, 16)) *# build the wake-on-lan "magic packet"... *msg = '\xff' * 6 + hw_addr * 16 *# ...and send it to the broadcast address using udp *s = socket.socket(socket.af_inet, socket.sock_dgram) *s.setsockopt(socket.sol_socket, socket.so_broadcast, 1) *s.sendto(msg, ('<broadcast>', 7)) *s.close() # example use wakeonlan('xx:xx:xx:xx:xx:xx')
Replace xx:xx:xx:xx:xx:xx with the mac address of the server you want to wake up. save this file as wol.py. I found this script on the XBMC forum (http://xbmc.org/forum/showthread.php?t=3450) so if cutting and pasting the above doesn't work take direct from the source.
3) With you favourite SCP software (FileZilla or something) copy the wol.py file into /Users/frontrow on your AppleTV
4) Chmod it so it can be executed:
chmod +x wol.py
5) Check it works by suspending you server then on you Apple TV run (this assumes you are in /Users/frontrow):
This should restart you server if not check the mac address is correct.
6) To make it do this when you boot you need to add this to rc.local
sudo echo "python /Users/frontrow/wol.py">>/etc/rc.local
You need to make sure you use the full path to the script.
Now you can test this by suspending your server and rebooting you AppleTV. It should restart the server. It worked first time for me!