9 lines
213 B
Bash
Executable file
9 lines
213 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
|
|
}
|