Skip to content

Instantly share code, notes, and snippets.

@lemmi
Last active October 19, 2020 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lemmi/46c5f4b7a41f81d49cf070be85c91f81 to your computer and use it in GitHub Desktop.
Save lemmi/46c5f4b7a41f81d49cf070be85c91f81 to your computer and use it in GitHub Desktop.
WOL with openwrt basic tools
#!/bin/sh
# see https://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet
MAGIC="\xFF\xFF\xFF\xFF\xFF\xFF"
MAC=${1:?"No mac address"}
MACHEX="\x$(echo $MAC | sed -e 's/:/\\x/g')"
netmsg 255.255.255.255 $(printf "$MAGIC$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX$MACHEX")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment