I went a bit different direction to solve this problem. I already have a 12V power system with battery backup, so I decided to run the Pi from that. I used the SleepyPi https://spellfoundry.com/product/sleepy-pi-2/ to safely shutdown the Pi when the battery voltage drops below the threshold I programmed. When the voltage recovers above another (higher) threshold, it boots up again. I can also read the current voltage over serial for logging, alerting, etc.

Here is the code I wrote to do it:
https://github.com/SpellFoundry/SleepyPi2/blob/master/examples/LowVoltageShutdown/LowVoltageShutdown.ino

If you have a slightly different application, you could modify the code to suit it.

Tom KD7LXL