Skip to main content

Yet another wake-on-lan library

Project description

wakeonlan

License pypi Language python

Yet another wake-on-lan command line script.

Why another one?

I couldn't find one that worked and did what I need. Specifically I need:

  • A command line utility that works on Mac, Windows and Linux
  • Can use saved configurations rather than force me to remember the MAC addresses of the machines I need to wake.
  • Ideally, let me manipulate (create, delete, update, list) saved configurations using the same utility.
  • Ideally, be open source so I can see what it is doing and know it doesn't do anything nefarious

None of the existing tools I found satisfied these criteria (even without the last two) so I wrote my own.

Setup

Pre-requisites: Python 3.7 or above. No additional packages required.

pip3 install eg.wakeonlan

On Windows, if you get a warning like:

WARNING: The script wakeonlan.exe is installed in 
'C:\Users\[username]\AppData\Roaming\Python\Python[VER]\Scripts' which is not on PATH.

You can either add this directory to your PATH or run pip3 install from Administrator command prompt.

The reason for this message is that Python does not add per user scripts directory to PATH on Windows, only the system-wide one. See this Python bug

Usage

Wake up a machine given its MAC address XX:XX:XX:XX:XX:XX

wakeonlan XX:XX:XX:XX:XX:XX [-a BroadcastAddress] [-p Port]

If not specified BroadcastAddress is 255.255.255.255 and Port is 9

Save wake up configuration to be used later

wakeonlan --save Name XX:XX:XX:XX:XX:XX [-a BroadcastAddress] [-p Port]

Name can be anything. The configuration is saved into $HOME/.wakeonlan file in JSON format --save can be abbreviated as -s

Wake up a machine given saved configuration name

wakeonlan Name

List existing configuration names

wakeonlan --list

--list can be abbreviated as -l

Delete a configuration

wakeonlan --delete Name

--delete can be abbreviated as -d

Transferring configurations to another machine

Saved configurations are stored in $HOME/.wakeonlan file (%USERPROFILE%\.wakeonlan for Windows users). Copy this file to another machine into equivalent location to transfer all the configurations.

Set up shell autocomplete

Autocomplete is supported for bash, zsh and powershell.

Bash

Add the following to your ~/.bashrc

source `wakeonlan --autocomplete-source`

Zsh

Add the following to your ~/.zhrc (make sure it is after the call to compinit)

source `wakeonlan --autocomplete-source`

Powershell

  1. If you haven't already done so, you will need to enable script execution on your machine.
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
  1. Remove "mark of the web" from the auto-complete script:
Unblock-File -Path $(wakeonlan --autocomplete-source)
  1. Find the location of your profile file:
echo $profile
  1. If it doesn't exist, create it. Then add the following to its content:
. $(wakeonlan --autocomplete-source)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eg_wakeonlan-1.3.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

eg.wakeonlan-1.3-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file eg_wakeonlan-1.3.tar.gz.

File metadata

  • Download URL: eg_wakeonlan-1.3.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for eg_wakeonlan-1.3.tar.gz
Algorithm Hash digest
SHA256 9c78a74b4c55ae6c4cf85b37a1dc16f3a8d0c940d1a17506399685c5d10d70ad
MD5 ca1aeb4c5ab06a1759431c56ae6189ef
BLAKE2b-256 663a3071a090075c171211c6b595cf94f81dd0dcffd27c647907a29d1cdb14c6

See more details on using hashes here.

File details

Details for the file eg.wakeonlan-1.3-py3-none-any.whl.

File metadata

  • Download URL: eg.wakeonlan-1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for eg.wakeonlan-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c4a4ae2285800e110d8254b88ad74a651b4e037a73fa0bd5d2bd8f725f6293d2
MD5 f2d124ecb72111402b6d270de7a32b14
BLAKE2b-256 64ddaf2e7a85ef6bafbc06200f6d01836c8bea046ea4281bbd5767fa875df820

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page