Last active
October 19, 2020 23:52
-
-
Save lemmi/46c5f4b7a41f81d49cf070be85c91f81 to your computer and use it in GitHub Desktop.
WOL with openwrt basic tools
This file contains hidden or 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
#!/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