foodotfiles/home/.scripts/hibernate-lowbattery.sh
2020-04-17 10:36:41 +03:00

10 lines
206 B
Bash
Executable File

#!/bin/sh
acpi -b | awk -F'[,:%]' '{print $2, $3}' | {
read -r status capacity
if [ "$status" = Discharging -a "$capacity" -lt 5 ]; then
logger "Critical battery threshold"
systemctl hibernate
fi
}