Created
March 28, 2016 16:22
-
-
Save jwmickey/58fa832d44500c52cc0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# simple command to wake on lan a host from a predefined list of presets. | |
# requires wakeonlan package to be installed | |
from wakeonlan import wol | |
import sys | |
if len(sys.argv) < 2: | |
print "Usage: %s <hostname>" % (sys.argv[0]) | |
sys.exit(0) | |
hosts = { | |
# DEFINE YOUR HOSTS HERE, e.g: | |
# <hostname>: <mac-address> | |
} | |
if sys.argv[1] in hosts: | |
wol.send_magic_packet(hosts[sys.argv[1]]) | |
else: | |
print "Unknown host: %s" % (sys.argv[1]) | |
print "Valid hosts are: %s" % (', '.join(hosts.keys())) | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment