ProxMox-Power (Wake-on-LAN + safe SSH shutdown)
Powers a home server (e.g. Proxmox) on with Wake-on-LAN, shuts it down cleanly over SSH, and checks whether it is up. Works from Linux, macOS and WSL (under WSL it sends the magic packet from Windows, because WSL's NAT network can't broadcast onto the LAN).
Commands
Run these with the exec tool. Each one prints a short result; pass it on to the user briefly.
- Check if the server is up:
bash {baseDir}/scripts/status.sh - Wake / turn on:
bash {baseDir}/scripts/wake.shSends the magic packet, then waits (default 5 minutes) for the server to answer ping. Servers usually take 1 to 3 minutes. Tell the user you're waking it before you run it. - Shut down / turn off:
bash {baseDir}/scripts/shutdown.shOnly when the user clearly asks to turn the server off. Sends a clean shutdown (Proxmox stops guests first), then waits (default 3 minutes) for it to stop answering. Tell the user it's shutting down before you run it.
Exit codes and what to tell the user
0success (or already in the requested state).1timed out: on wake, the packet went out but the server never answered (sender not on the server's LAN, cable not in the WoL-enabled NIC, WoL disabled in BIOS/OS, or no power); on shutdown, the command was accepted but the server still answers (guests may still be stopping). Report it; don't retry in a loop.2shutdown was NOT sent (SSH failed, usually "Permission denied" because the key isn't installed on the server). Tell the user; don't try other logins or credentials.3missing config.4couldn't send the magic packet.
One-time setup
- Copy
{baseDir}/config.example.envto~/.config/proxmox-power/config.envand fill in the server's address, the MAC address(es) of its WoL-enabled NIC(s), and broadcast address(es).PROXMOX_POWER_CONFIGcan point to a different path. - Turn on Wake-on-LAN in the server's BIOS and OS (on Proxmox/Debian, e.g.
ethtool -s <nic> wol g, made persistent in/etc/network/interfaces). - Run
bash {baseDir}/scripts/setup-key.sh. It creates a dedicated SSH key and prints anauthorized_keysline. The user adds that line on the server (e.g. Proxmox web UI → node → Shell →nano /root/.ssh/authorized_keys). The line pins the key toshutdown -h nowwith no shell, forwarding or PTY, so the key can't be used for anything else. - Test with
status.sh,wake.shandshutdown.sh.
Security notes
- The agent never gets a shell on the server: the only SSH key it uses is forced to a single shutdown command on the server side.
- Your addresses and MACs live in your local config file, not in the skill.
- The magic packet needs no credentials; anyone on your LAN can send one.
