Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Sleep 1 minute
- SLEEP_INTERVAL=60
- while :; do
- LAST_FULL_CAPACITY=`cat /proc/acpi/battery/BAT0/info \
- | grep '^last full capacity:'| awk '{print $4}'`
- REMAINING_CAPACITY=`cat /proc/acpi/battery/BAT0/state \
- | grep '^remaining capacity:' | awk '{print $3}'`
- BATT_PERCENT=`echo "($REMAINING_CAPACITY / $LAST_FULL_CAPACITY) * 100" \
- | bc -l | awk 'BEGIN{FS="\."} {print $1}'`
- if < $BATT_PERCENT -le "1" >; then
- DISPLAY=:0.0 notify-send -u critical -i \
- /usr/share/icons/gnome/scalable/status/battery-caution.svg \
- 'Warning' 'Battery power is CRITICAL! Going to sleep mode NOW!'
- sleep 5;
- DISPLAY=:0.0 gksudo -m \
- 'Please enter your password and I am get some sleep' s2disk
- elif < $BATT_PERCENT -le "5" >; then
- DISPLAY=:0.0 notify-send -u critical -i \
- /usr/share/icons/gnome/scalable/status/battery-low.svg \
- 'Warning' 'Battery power is low!'
- fi
- sleep $SLEEP_INTERVAL
- done
- lowbatt_notify.sh: line 27: syntax error near unexpected token `;'
- lowbatt_notify.sh: line 27: ` if < $BATT_PERCENT -le "1" >; then'
Add Comment
Please, Sign In to add comment