Skip to content

Instantly share code, notes, and snippets.

@r4um
Created September 21, 2014 06:30
Show Gist options
  • Save r4um/99f531ab94966cf9a297 to your computer and use it in GitHub Desktop.
Save r4um/99f531ab94966cf9a297 to your computer and use it in GitHub Desktop.
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