Send Wake On Lan packet to a host CLI Example: .. code-block:: bash salt '*' network.wol 08-00-27-13-69-77 salt '*' network.wol 080027136977 255.255.255.255 7 salt '*' network.wol 08:00:27:13:69:77 255.255.255.255 7
(mac, bcast="255.255.255.255", destport=9)
| 38 | |
| 39 | |
| 40 | def wol(mac, bcast="255.255.255.255", destport=9): |
| 41 | """ |
| 42 | Send Wake On Lan packet to a host |
| 43 | |
| 44 | CLI Example: |
| 45 | |
| 46 | .. code-block:: bash |
| 47 | |
| 48 | salt '*' network.wol 08-00-27-13-69-77 |
| 49 | salt '*' network.wol 080027136977 255.255.255.255 7 |
| 50 | salt '*' network.wol 08:00:27:13:69:77 255.255.255.255 7 |
| 51 | """ |
| 52 | dest = __utils__["network.mac_str_to_bytes"](mac) |
| 53 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
| 54 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) |
| 55 | sock.sendto(b"\xff" * 6 + dest * 16, (bcast, int(destport))) |
| 56 | return True |
| 57 | |
| 58 | |
| 59 | def ping(host, timeout=False, return_boolean=False): |
nothing calls this directly
no test coverage detected