batteryobserver: changes sleep rate

This commit is contained in:
madmaurice 2016-11-05 22:15:57 +01:00
parent 4e07e40a77
commit 537804d996

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
if [ -n "$(pgrep batteryobserver)" ]; then
exit 0
fi
#Config #Config
WARNING_LEVEL=10 WARNING_LEVEL=10
SHUTDOWN_LEVEL=2 SHUTDOWN_LEVEL=2
@ -21,6 +25,8 @@ while true; do
1) # battery low 1) # battery low
if [ -n "$charger_connected" ]; then if [ -n "$charger_connected" ]; then
STATE=0 STATE=0
elif [ "$level" -gt "$WARNING_LEVEL" ]; then
STATE=0
elif [ "$level" -le "$SHUTDOWN_LEVEL" ]; then elif [ "$level" -le "$SHUTDOWN_LEVEL" ]; then
systemctl hibernate; systemctl hibernate;
else else
@ -29,11 +35,11 @@ while true; do
;; ;;
esac esac
if [ $level -gt 50 ]; then if [ $level -gt 50 ]; then
sleep 40m
elif [ $level -gt 30 ]; then
sleep 10m
else
sleep 2m sleep 2m
elif [ $level -gt 30 ]; then
sleep 1m
else
sleep 5
fi fi
done done