ordered into /lib

put all subscripts into lib for readability
This commit is contained in:
2026-07-14 16:56:28 +02:00
parent 925c624351
commit 20781c9d90
11 changed files with 6 additions and 20 deletions

30
lib/battery.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
function BATTERY(){
local OUT_FILE=$1
for b in /sys/class/power_supply/BAT*; do
[ -d "$b" ] && BATTERY="$b" && break
done
if [ -z "$BATTERY" ]; then
echo -e "Kein akku gefunden">>"$OUT_FILE"
return 1
fi
if [ -f "$BATTERY/capacity" ]; then
CAPACITY=$(cat "$BATTERY/capacity")
else
echo -e "Akku kann nicht gelesen werden">>"$OUT_FILE"
return 1
fi
if [ "$CAPACITY" -gt 0 ]; then
echo -e "Akku bei $CAPACITY % ">>"$OUT_FILE"
return 0
else
echo -e "Akkustand 0%, prüfen">>"$OUT_FILE"
return 1
fi
}