Guest User

Untitled

a guest
May 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4.  
  5. # Sleep 1 minute
  6.  
  7. SLEEP_INTERVAL=60
  8.  
  9.  
  10.  
  11. while :; do
  12.  
  13. LAST_FULL_CAPACITY=`cat /proc/acpi/battery/BAT0/info \
  14.  
  15. | grep '^last full capacity:'| awk '{print $4}'`
  16.  
  17. REMAINING_CAPACITY=`cat /proc/acpi/battery/BAT0/state \
  18.  
  19. | grep '^remaining capacity:' | awk '{print $3}'`
  20.  
  21. BATT_PERCENT=`echo "($REMAINING_CAPACITY / $LAST_FULL_CAPACITY) * 100" \
  22.  
  23. | bc -l | awk 'BEGIN{FS="\."} {print $1}'`
  24.  
  25.  
  26.  
  27. if < $BATT_PERCENT -le "1" >; then
  28.  
  29. DISPLAY=:0.0 notify-send -u critical -i \
  30.  
  31. /usr/share/icons/gnome/scalable/status/battery-caution.svg \
  32.  
  33. 'Warning' 'Battery power is CRITICAL! Going to sleep mode NOW!'
  34.  
  35. sleep 5;
  36.  
  37. DISPLAY=:0.0 gksudo -m \
  38.  
  39. 'Please enter your password and I am get some sleep' s2disk
  40.  
  41. elif < $BATT_PERCENT -le "5" >; then
  42.  
  43. DISPLAY=:0.0 notify-send -u critical -i \
  44.  
  45. /usr/share/icons/gnome/scalable/status/battery-low.svg \
  46.  
  47. 'Warning' 'Battery power is low!'
  48.  
  49. fi
  50.  
  51.  
  52.  
  53. sleep $SLEEP_INTERVAL
  54.  
  55. done
  56.  
  57.  
  58. lowbatt_notify.sh: line 27: syntax error near unexpected token `;'
  59. lowbatt_notify.sh: line 27: ` if < $BATT_PERCENT -le "1" >; then'
Add Comment
Please, Sign In to add comment