Created
September 21, 2014 06:30
-
-
Save r4um/99f531ab94966cf9a297 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"fmt" | |
"github.com/ghthor/gowol" | |
"os" | |
) | |
func main() { | |
if len(os.Args) < 3 { | |
fmt.Fprintf(os.Stderr, "usage %s <mac> <broadcast>\n", os.Args[0]) | |
os.Exit(1) | |
} | |
mac := os.Args[1] | |
baddr := os.Args[2] | |
err := wol.MagicWake(mac, baddr) | |
if err != nil { | |
fmt.Fprintf(os.Stderr, "failed to send wol packet, mac %s, broadcast %s, reason %s\n", mac, baddr, err) | |
} else { | |
fmt.Fprintf(os.Stdout, "packet sent mac %s, broadcast %s\n", mac, baddr) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment