Public paste
Undefined
By: Guest | Date: Dec 26 2009 21:56 | Format: None | Expires: never | Size: 819 B | Hits: 452

  1. #!/bin/bash
  2. STATUS=`acpi -p | awk '{print $3}' | cut -d, -f1`
  3. case STATUS in
  4. charged) echo "battery is fully charged" ;;
  5. charging) echo "still charging up" ;;
  6. discharging) echo "discharging" ;;
  7. if [ "$TATUS" != "discharging" ]; then
  8. # reset back to normal
  9. echo 0 > /proc/sys/vm/laptop_mode
  10.   echo 10 > /proc/sys/vm/dirty_ratio
  11.   echo 5 > /proc/sys/vm/dirty_background_ratio
  12.   echo 500 > /proc/sys/vm/dirty_writeback_centisecs
  13.   echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy
  14. else
  15. # Turn on aggressive power savings
  16.   echo 5 > /proc/sys/vm/laptop_mode
  17.   echo 40 > /proc/sys/vm/dirty_ratio
  18.   echo 10 > /proc/sys/vm/dirty_background_ratio
  19.   echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
  20.   echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
  21. fi