mirror of
https://github.com/vittorio88/cisco-scripts.git
synced 2025-02-14 10:51:57 +00:00
add wol script
This commit is contained in:
parent
2078381586
commit
8695ba052e
1 changed files with 30 additions and 0 deletions
30
wol.tcl
Normal file
30
wol.tcl
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
## This script sends a WoL packet to destination MAC address
|
||||||
|
## how to use:
|
||||||
|
## tclsh flash:wol.tcl 0014D13F25F0
|
||||||
|
##
|
||||||
|
|
||||||
|
set macAddr [lindex $argv 0]
|
||||||
|
set broadcastAddr 255.255.255.255
|
||||||
|
|
||||||
|
proc WakeOnLan { } {
|
||||||
|
global macAddr
|
||||||
|
global broadcastAddr
|
||||||
|
set net [binary format H* [join [split $macAddr -:] ""]]
|
||||||
|
set pkt [binary format c* {0xff 0xff 0xff 0xff 0xff 0xff}]
|
||||||
|
|
||||||
|
for {set i 0} {$i < 16} {incr i} {
|
||||||
|
append pkt $net
|
||||||
|
}
|
||||||
|
|
||||||
|
# Open UDP and Send the Magic Paket.
|
||||||
|
set udpSock [udp_open]
|
||||||
|
fconfigure $udpSock -translation binary \
|
||||||
|
-remote [list $broadcastAddr 4580] \
|
||||||
|
-broadcast 1
|
||||||
|
puts $udpSock $pkt
|
||||||
|
flush $udpSock;
|
||||||
|
close $udpSock
|
||||||
|
}
|
||||||
|
|
||||||
|
WakeOnLan
|
Loading…
Reference in a new issue