JimS said:
Not sure exactly what your point is. If the power goes out for longer than the backup you need something to power it until it can shut down. You also need something to detect power dropped to do the shutdown. And you need to have the pi reboot if power comes back on which can be complicated if the power comes back on fairly quickly. So there are some timing details.
But most of my outages are short ones of maybe as long as a minute. I can only remember one day long outage during a big ice storm in the last 15 years so I haven't bothered to deal with shutdown since just having a short backup takes care of all but the once every 15 years events.
Another choice is to use something that can handle power drops and restart when power is restored. Lots of other devices do that so thinking about other options than the pi. I am familiar with the pi and going to something else will involve some extra effort though...
No negativity intended, rather a need for clarification.
My point was it seemed like you had no power backup supporting the pi, and that outages were leading to corruption on the sdcard. If you have power backup then it would seem like sending network commands to handle shutdown should avoid the shutdown corruption problem.
What that would lack, however, would be signaling the device to resume operating on the return of /reliable/ power. To avoid the hassle of a resumption being 'false' and the power going back down again; made worse by being faster than network signaling could handle. That and it runs into the problem of too many interdependent pieces. For a PC this would be relatively simple using Wake-On-LAN. (he says, knowing full well that WoL is never a guaranteed scenario either).
So that leads to the question of how to best handle power-on state in that Pi. I've not looked into it, do any of the PoE switches out there support software control over the power to the port? That would be one way, in that presumably something capable of interacting with a switch would also be capable of being programmed/scripted such that it could be sensible about power management on the Pi.
I have to think there's a 'wheel reinvention' developing here. But I've not followed the Pi communities a lot so I'm not savvy on how they're approaching this lately.