-
Notifications
You must be signed in to change notification settings - Fork 1
/
powersave
37 lines (27 loc) · 1 KB
/
powersave
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Description: This script is used to expand battery life by applying some powersaving tweaks.
# Dependency: cpupower, wireless-tools
# set cpu governor to powersave
sudo cpupower frequency-set -g powersave > /dev/null
# disable bluetooth
sudo systemctl stop bluetooth.service
# enable Wi-Fi power management
sudo iwconfig wlo1 power on
# enable SATA power management
sudo hdparm -B 1 /dev/sda
# enable USB autosuspend
for usb_device in /sys/bus/usb/devices/*/power/control; do
echo 'auto' | sudo tee "$usb_device" > /dev/null
done
# enable PCIe ASPM to auto
for pcie_device in /sys/bus/pci/devices/*/power/control; do
echo 'auto' | sudo tee "$pcie_device" > /dev/null
done
# disable NMI watchdog
echo '0' | sudo tee /proc/sys/kernel/nmi_watchdog > /dev/null
# disable Wake-on-Timer
echo '0' | sudo tee /sys/class/rtc/rtc0/wakealarm > /dev/null
# enable runtime PM for selected devices
for device in /sys/bus/usb/devices/*/power/control; do
echo 'auto' | sudo tee "$device" > /dev/null
done