Hello Simple!
Tuesday January 12 2021 12:14, you wrote to All:
You have another 2/3 possible issues :-
- crontab will only run the script at the defined point of time so you need to run it often OR better still as a subtask from a routine that WILL run if the battery is low at a given point (not almost flat) to shutdown the system , NOTE the term shutdown by using similar to shutdown -h now and not halt which may well not close down any processes running first and possbly cause curruptions on your system disk / SD etc.
- As a follow on from 1 , you need a low level process that is constantly running say with a sleep of nn seconds that tests the battery state and if good sleeps or runs process similar to your bash script but not it and suggest say a little C process as it would use less resources.
- As a follow on from both of the above. You should check what battery setting you have for throttled and have it set to at least 25% battery power if you have a lot of proceses that can be running at any one time and if needed a higher value.
I have a similar set of processes but linked to a APC UPS so see package apcupsd.
Vincent