This technology has been around for a while, but I still think it’s cool.
If you have a computer you sometimes want to start up from a different computer, then you could send a Wake On LAN packet to the computer if it’s enabled for that.
Here’s a Python script I wrote that to wake up my computer at work if it was shut down, so I wouldn’t have to drive in just to start it up — the wake-on-LAN packet would be sent from another server on the internal network.
# Program: wakeup.py # Purpose: Sends a magic wakeup packet to the MAC address specified in the current user's .wolrc file # Programmer: Daniel Meyer # # Notes: The magic packet is actually built by wolpython.py, written by Marc Balmer. # See http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/wolpython.txt import os,sys,re,string import wolpython def mac_well_formed(mac): return re.match('[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]', mac) # Main walrus_filename = os.environ['HOME'] + '/.wolrc' if not os.path.exists(walrus_filename): print 'wakeup: please place the MAC address of the computer you want to wake in ' + walrus_filename sys.exit() walrus = open(os.environ['HOME'] + '/.wolrc') mac = string.strip(walrus.readline()) while mac != '': if mac_well_formed(mac): print 'Sending wakeup message to ' + mac + '...', wolpython.WakeOnLan(mac) print 'done.' else: print 'MAC address "' + mac + '" skipped (not in xx:xx:xx:xx:xx:xx format).' mac = string.strip(walrus.readline())
If the computer-you-want-to-wake is running Linux, you can find its network address by running
/sbin/ifconfig and looking for the HWaddr; on Windows, run
ipconfig /all from the command prompt and look for the Physical Address.
This script is a little silly, because it has this idea of a .wolrc (“walrus”) file that contains the computer you always want to wake up, and it is only designed to work on Unix/Linux (it expects a HOME environment variable) — not very full-featured. I was proud of the walrus filename though. :)
You’d probably be better off using java-wakeonlan!
(Is it even really worth having my home computer’s network card always be awake listening for a wake-on-LAN packet that it might get once every couple of weeks? Hmm…)