Using a Raspberry Pi to control a togglable power strip that a laptop-server is plugged in to. This is completely tailored to my own needs and is not necessarily meant to be something anyone can download and run. I've put it here to serve as some inspiration for others who may have similar needs or situations.
The power strip I use is one of these
server.py on the Raspberry Pi and run the script on boot with sufficient privileges to control the GPIO pins. The script is set up to use pin 36 to toggle the power strip, so update that if you don't want to use that pin.
client.py on your server and run it every X minutes using
cron or similar. Change the
server_ip variable in
client.py to have your server's IP address.