diff --git a/scripts/.config/scripts/batteryobserver.sh b/scripts/.config/scripts/batteryobserver.sh index 3d13a9c..2ed0367 100755 --- a/scripts/.config/scripts/batteryobserver.sh +++ b/scripts/.config/scripts/batteryobserver.sh @@ -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