I have my Mac Mini and my NAS attached to the same UPS. The NAS (FreeNAS) exposes the UPS and I can easily read its status using the upsc command. However, after extensive googling, I did not find a turn-key solution to make my mac shut down after 30 on battery power or UPS disappearing from the network (meaning the FreeNAS had shut itself down).
The FreeNAS is currently set up to wait for battery to go low before shutting down (that should take around 10m) and I would like my mac to shut down after 30s of power outage (meaning that 5s-like blackouts should be just ignored).
I also need it all to shut down "correctly" - the Mini is running VMWare images that are stored on the FreeNAS and I would like the mini to go first before the NAS shuts down.
I am tempted to just write a simple bash script that would parse the upsc output and issue a shutdown but surely, there must be something already out here?