I have a project that uses Pi's in remote locations (roadside cabinets dotted around a city next to important bits of water infrastructure) to read data via USB from some specialised data collection equipment and then transmit it (via an ADSL link) back up to a central DB. The Pi's are powered from a 5V supply derived from an industrial UPS (a Phoenix Contact MINI-DC-UPS) and the control signals from this UPS are managed by the data collection equipment so that messages can be inserted into the normal data stream from it to the Pi.
When the mains supply is out and the battery has dropped to a certain low voltage the UPS will raise an "ALARM" signal and the data collection equipment will inform the Pi that the power could go out at any time. If the supply recovers without being turned off the ALARM signal will go away and the Pi will be informed that it can go back to normal operation.
Having the Pi suddenly power down while in normal operation could corrupt the SD card so what is the best strategy for handling this? Can I put the Pi into a "safe" mode (remount the disk as read-only?) while waiting for a "power ok" signal or do I need to look at the various powerfail options listed in /etc/inittab
?
Can anyone give me any pointers?