batteryobserver: changes sleep rate
This commit is contained in:
parent
4e07e40a77
commit
537804d996
1 changed files with 10 additions and 4 deletions
|
@ -1,5 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -n "$(pgrep batteryobserver)" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#Config
|
||||
WARNING_LEVEL=10
|
||||
SHUTDOWN_LEVEL=2
|
||||
|
@ -21,6 +25,8 @@ while true; do
|
|||
1) # battery low
|
||||
if [ -n "$charger_connected" ]; then
|
||||
STATE=0
|
||||
elif [ "$level" -gt "$WARNING_LEVEL" ]; then
|
||||
STATE=0
|
||||
elif [ "$level" -le "$SHUTDOWN_LEVEL" ]; then
|
||||
systemctl hibernate;
|
||||
else
|
||||
|
@ -29,11 +35,11 @@ while true; do
|
|||
;;
|
||||
esac
|
||||
if [ $level -gt 50 ]; then
|
||||
sleep 40m
|
||||
elif [ $level -gt 30 ]; then
|
||||
sleep 10m
|
||||
else
|
||||
sleep 2m
|
||||
elif [ $level -gt 30 ]; then
|
||||
sleep 1m
|
||||
else
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue