Skip to content

mboyov/wakecli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wake-on-LAN CLI Tool

📌 Overview

This script provides a simple command-line tool for managing and waking up remote machines using Wake-on-LAN (WoL). It supports both Linux (Ubuntu) and macOS, with automatic detection of MAC addresses and broadcast IPs.

🚀 Features

  • ✅ Wake-on-LAN automation
  • ✅ Automatically retrieves MAC address from IP
  • ✅ Automatically detects broadcast IP
  • ✅ Verifies if wakeonlan is installed
  • ✅ Stores and manages multiple machines
  • ✅ Checks if a machine wakes up (ping for 30s)
  • ✅ Cross-platform: Linux & macOS

💪 Installation

1️⃣ Install Wake-on-LAN

Ubuntu/Linux

sudo apt install wakeonlan

macOS

brew install wakeonlan

2️⃣ Clone and Install the CLI

git clone https://github.com/mboyov/wakecli.git
cd wakecli

# Make sure the main script is executable
chmod +x bin/wake.sh

# Optional: install globally (requires sudo)
sudo ln -s "$(pwd)/bin/wake.sh" /usr/local/bin/wake

ℹ️ If you install globally, the config will be stored at ~/.config/wakecli/hosts.


3️⃣ (Optional) Add an Alias

echo "alias wol='wake wake'" >> ~/.zshrc
source ~/.zshrc

📦 Project Structure

wakecli/
├── bin/             # Main CLI script
│   └── wake.sh
├── config/          # Default machine database (example)
│   └── hosts
├── lib/             # Shared functions
│   ├── utils.sh
│   └── network.sh
├── tests/           # Test runner
│   └── wake.sh
└── README.md

📌 Usage

Add a Machine

wake add <machine_name> <ip_address>

Example:

wake add neoserv 192.168.1.10

List Registered Machines

wake list

Wake a Machine

wake wake <machine_name>

Remove a Machine

wake remove <machine_name>

🔍 How It Works

  1. Gets the MAC address from the ARP cache or ip neigh.
  2. Derives the broadcast IP from your interface.
  3. Sends a WoL packet to the target.
  4. Waits up to 30 seconds, pinging every 2s.
  5. Reports success or failure.

⚠️ Troubleshooting

  • Wake-on-LAN must be enabled in BIOS/UEFI.
  • Use wake list to check saved MAC/broadcast info.
  • Try sending manually: wakeonlan <mac_address>
  • Ensure the machine is connected via Ethernet.
  • WoL does not work over Wi-Fi in most cases.

📝 License

This tool is open-source. Use it, improve it, share it.

GitHub: mboyov/wakecli


🚀 You now have a clean, reliable CLI for waking up your machines. Enjoy!

About

Wake-on-LAN CLI Tool

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages