So I recently got a CyberPower UPS, and I wanted to have the PC take a certain action on return of power to the UPS after a blackout. Neither PowerPanel Personal or PowerPanel Business offered this, so I ended up using PowerPanel Business and modifying shutdown.sh in its program directory to run this python script I wrote.
This script includes a script that gets run at shutdown only when its because fo the UPS, and one that runs every time at startup. The shutdown script makes a file, the startup one checks for it and runs a script if its there. Pretty simple, but no program seemed to offer this natively, and I wanted to use Wake On LAN after blackouts to make everything turn on again all by itself. I looked into NUT, but I didn’t want to have to write a script for that when PowerPanel Business was so easy to “fix”.
TL;DR If you have a UPS, and you wanna make a Linux machine run a script when it returns from a power outage shutdown, I saved your bacon!
You can find this script on GitHub with an auto installer here:
Let me know if you guys use it, I wanna know how it works out. I can add features if you guys would like, I was considering making a system to build auto installers for servers for large deployments, but I don’t know if its worth itif nobody will use it. Send me mail about it! I like mail!