Skip to content

Instantly share code, notes, and snippets.

@cmavr8
Created June 11, 2011 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmavr8/1020553 to your computer and use it in GitHub Desktop.
Save cmavr8/1020553 to your computer and use it in GitHub Desktop.
Laptop power saving - for a Lenovo X201s running Ubuntu 11.04
#!/bin/bash
rfkill block bluetooth
iwconfig wlan0 power on
iwconfig wlan0 txpower 30mW
iwconfig wlan0 power timeout 500ms
killall dropbox
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
if [[ $1 == "max" ]]
then
echo "Max power saving settings"
##Networking down:
service network-manager stop
/etc/init.d/networking stop
modprobe -r iwlagn bnep btusb
killall nm-applet
fi
if [[ $1 == "restore" ]]
then
echo "Restoring Medium power saving settings"
service network-manager start
/etc/init.d/networking start
sudo modprobe iwlagn
sudo modprobe bnep
sudo modprobe btusb
nm-applet &
dropbox start &
fi
powertop
@cmavr8
Copy link
Author

cmavr8 commented Jun 11, 2011

Usage: run the script as root when you are on battery (bluetooth gets disabled).

For max battery life run it with the option "max" (networking gets disabled).
To restore normal operation run it with option restore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment