I recently started to run a bitcoin node on my old netbook with Linux Mint 18 OS loaded. I was running a raspberry pi3 node but I sometimes get power cuts in my area and my database gets corrupted because my little pi don't have any batteries attached on it to protect itself. (nor does the USB hub which is connected to my HDD)
On the other hand my old netbook has a battery...
Is it possible to trigger
command automatically before my netbook goes into sleep mode when its battery runs low?
For example; My netbook goes into sleep mode when there is %10 of the battery juice left but I want bitcoind to shut itself down when there is %15 left so it will be a super safe shut down. No fuck ups, no conflicts...
Or, Is it necessary at all?
You could always use a command that checks if the netbook is charging, once the charger is removed, the node shuts down. Depending on how old it is, it might take mre than ~8% ttery to shutdown on (assuming it'll shutdown after 7% is left).
Else, use 25-30% just to make it safer for the node (if it's always plugged in, then you can expect the battery to start to drain as well powerwise after a few weeks/months depending on its reliability.