SoL is a service that listens for Wake-on-LAN magic packets and shuts down the system when received.
This project was inspired by the article "Выключаем компьютер через Wake-on-Lan" on Habr, which demonstrates how to repurpose Wake-on-LAN packets for shutdown functionality instead of wake-up.
The sol service is built using cobra CLI framework and Go standard library.
The listen command listens for Wake-on-LAN magic packets on the specified network interface and shuts down the system when a matching packet is received.
The service listens for Wake-on-LAN magic packets on UDP ports (commonly 7 or 9). When a magic packet containing the target MAC address is received, the system is shut down.
sol listen --iface eth0--iface: Network interface name to bind to (required)--port: UDP port to listen on (default: 9)--dry-run: Log when a matching packet is received instead of shutting down
Download the latest release for your platform and architecture:
Linux AMD64:
curl -L https://github.com/bavix/sol/releases/download/v0.0.2/sol-v0.0.2-linux-amd64.tar.gz | tar -xz && sudo mv sol /usr/local/bin/Linux ARM64:
curl -L https://github.com/bavix/sol/releases/download/v0.0.2/sol-v0.0.2-linux-arm64.tar.gz | tar -xz && sudo mv sol /usr/local/bin/macOS Intel:
curl -L https://github.com/bavix/sol/releases/download/v0.0.2/sol-v0.0.2-darwin-amd64.tar.gz | tar -xz && sudo mv sol /usr/local/bin/macOS Apple Silicon:
curl -L https://github.com/bavix/sol/releases/download/v0.0.2/sol-v0.0.2-darwin-arm64.tar.gz | tar -xz && sudo mv sol /usr/local/bin/Windows (PowerShell):
Invoke-WebRequest -Uri "https://github.com/bavix/sol/releases/download/v0.0.2/sol-v0.0.2-windows-amd64.zip" -OutFile "sol.zip"
Expand-Archive -Path "sol.zip" -DestinationPath "." -Force
move sol.exe C:\Windows\System32\sol.exesol --helpTo run SoL as a systemd service that starts automatically:
-
Create systemd unit file
sudo nano /etc/systemd/system/sol.service
Add the following content:
[Unit] Description=SOL listener After=network-online.target Wants=network-online.target [Service] ExecStart=/usr/local/bin/sol listen --iface enp2s0 --port 9 Restart=always RestartSec=5 User=root [Install] WantedBy=multi-user.target
Important: Replace
enp2s0with your actual network interface name. -
Reload systemd configuration
sudo systemctl daemon-reload
-
Enable autostart
sudo systemctl enable sol.service -
Start the service
sudo systemctl start sol.service
-
Check service status
sudo systemctl status sol.service
-
View logs
journalctl -u sol.service -f
After=network-online.targetensures the service starts after the network is fully onlineRestart=alwaysautomatically restarts the service if it crashes- For production use, remove
--dry-runflag from the ExecStart command - Consider creating a dedicated user instead of running as root for better security