scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 947dd058da448167406fb3904a78459d825f19b8
parent 75a621289739be74082421274411ba446543c0a7
Author: z3bra <willy@mailoo.org>
Date:   Tue Jan 28 17:16:37 +0100

Script that beeps on low battery

Diffstat:
battery.sh | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/battery.sh b/battery.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Beep once when under 15%, twice under 10, and three times under 5% +# Under 3%, you're asked to shutdown + +BATC=`cat /sys/class/power_supply/BAT1/capacity` +BATS=`cat /sys/class/power_supply/BAT1/status` + +test "$BATS" == "Charging" && exit + +if test $BATC -gt 3; then + test $BATC -lt 15 && beep -f1000 -l200 -D50 + test $BATC -lt 10 && beep -f1000 -l200 -D50 + test $BATC -lt 5 && beep -f1000 -l200 -D50 +else + test $BATC -lt 3 && espeak 'Battery is empty, please shut down' +fi