Package: awake
Command and library to “wake on lan” a remote host.If you  want to know something more about the WoL stuff checkthe wikipedia page.Usage: awake [options] MAC1 [MAC2 MAC3 MAC...]

    Options:
      --version             show program's version number and exit
      -h, --help            show this help message and exit
      -p PORT, --port=PORT  Destination port. (Default 9)
      -b BROADCAST, --broadcast=BROADCAST
                            Broadcast ip of the network. (Default 255.255.255.255)
      -d DESTINATION, --destination=DESTINATION
                            Destination ip/domain to connect and send the packet,
                            by default use broadcast.
      -f FILE, --file=FILE  Use a file with the list of macs, separated with -s,
                            by default \n. If any mac (line where -s \n), have the
                            "#" character, any following character is considered a
                            comment. Can be used multiple times for multiple
                            files.
      -s SEPARATOR, --separator=SEPARATOR
                            Pattern to be use as a separator with the -f option.
                            (Default \n)
      -q, --quiet           Do not output informative messages.RequirementsAny cpython (common python) implementation  from 2.4 to 3.X.Probably it also works with jython, ironpython and pypy but I haven’t
personally tested on those implementations.Installationpip install awakeOr with the oldeasy_installeasy_install awakeOr with the sourcepython setup.py installUpgrading from 0.X to 1.0Make sure the previous CLI scriptawake.pygets removed from the script installation
path after the upgrading, e.g. in linux/usr/bin/the new cli interface is
justawakeand  if the fileawake.pyexists at the same level of the script
then the newawakegoing to try to fetch the required modules from the
old cli scriptawake.py.CLI ExamplesWake-on-lan a group of computers in the current network:awake 1c:6f:65:31:aa:5f 1c6c2531e051 3f.6c.25.31.e0.55 3b-6c-21-31-e0-41which is equivalent to:awake -f ~/list_of_macsand in the filelist_of_macshave one MAC per line or use the-soption.list_of_macscontent:1c:6f:65:31:aa:5f # web1
1c6c2531e051      # web2
# The rest
3f.6c.25.31.e0.55
3b-6c-21-31-e0-41The format of the MAC is flexible in the sense that can use any character to group
the digits of the MAC, except for the reserved character#for comments.Wake-on-lan a computer or group of computers in a external networkFor this situation, you need to forward a port in your router, for example to
forward 9999 to 9 in the local network o 7777 to 7, check the documentation if
your router or modem. After the port has been configured you can useDDNSto have a reference to the current ip address of your router/modem and use awake
in this way:awake -d myhouse.homedns.com -p 9999 -f ~/file_with_my_macsor use any other option, the important here is to use the-dand-poptions
to specify the destination to send the magic packet.Alternative method to invoke awakeAwake can be used calling the module directly from python:python -m awakeIs the same interface as the installed scriptawake, this is very useful in
platforms like windows, when thePythonXX/Scriptsis not set in thePATH.As a libraryThe real functionality of the wake-on-lan is provided from a small function
that is implemented in the provided moduleawake.wol:send_magic_packet(mac, broadcast='255.255.255.255', dest=None, port=9)
    Send  a "magic packet" to the given destination mac to wake up
    the host, if `dest` is not specified then the packed is broadcasted.Apart from the awake script the WOL functionality can be easily integrated
in your python programs with a simple call to the function like:from awake import wol

def sysadmin_function_x(mac, *args):
    # some stuff...
    wol.send_magic_packet(mac)
    # some more stuff...TestsThe tests are designed to be executed with the python unittest module,
you can run the tests from the foldertest:cd test
python -m unittest discoverIn case that you want to run the tests in python < 2.7, you will need theunittest2module.The general recommended process to develop is usingvirtualenvand after creating the
environ just run:./environ/bin/python setup.py install
./environ/bin/python -m unittest discoverImprovements, bugs?For any improvement or bug, feel free to create anissuein the github project.