We want to put a computer (probably an industrial computer) with Linux on a system powered by a battery. The computer will be configured to power on when the battery is powered-on The battery has a BMS, a button and some pins and/or a serial port that can be used to power it on or off.
If I want to shutdown the battery from the computer, for example by sending the signal to the battery from a serial port, how can I do? Do I have to create a kernel module to replace the usual ACPI shutdown? Or can I just setup a script that does a sync, remount the file-system in read-only and send the signal to the battery?
I'm sure there is a best-practice and a lot of examples but I can't find them.