A macOS battery monitoring script that automatically shuts down your system when the battery level falls below a specified threshold. The script includes optional stress testing to accelerate battery drain and prevent system sleep during monitoring.
Designed for battery storage scenarios where you need to maintain optimal charge levels (typically 50-80%) for long-term storage, or when used with tools like Battery Toolkit to operate devices below 100% charge for better battery health. Run with ./drain-battery.sh <threshold_percentage> (e.g., ./drain-battery.sh 70 to shutdown at 70% battery). Install dependencies with make install.
Note: Currently does not support charging scenarios. If the current battery level is below the desired threshold, the script will shutdown the computer rather than charge to the target level.