-
Notifications
You must be signed in to change notification settings - Fork 6
/
powersave
executable file
·45 lines (40 loc) · 2.19 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
38
39
40
41
42
43
44
45
#!/bin/bash
# Get rid of bt_usb
rfkill block bluetooth
# Turn off unnecessary network interfaces (i.e. all but wifi)
ip link set br-999d1b277ac3 down
ip link set enp4s0 down
ip link set docker0 down
# Turn off unnecessary services that may draw power
systemctl stop docker.socket
systemctl stop docker.service containerd.service
systemctl stop lxc.service lxcfs.service lxc-net.service
systemctl stop code42.service
systemctl stop crashplan.service
systemctl stop tor.service
# powertop tunables
echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy'
echo 'min_power' > '/sys/class/scsi_host/host4/link_power_management_policy'
echo 'auto' > '/sys/bus/pci/devices/0000:00:17.0/ata1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:17.0/ata2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:17.0/ata3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:17.0/ata4/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:17.0/ata5/power/control'
echo 'auto' > '/sys/bus/usb/devices/1-2/power/control' # YubiKey
echo 'auto' > '/sys/bus/usb/devices/2-2/power/control' # YubiKey
echo 'auto' > '/sys/bus/usb/devices/3-2/power/control' # YubiKey (Framework)
echo 'auto' > '/sys/bus/usb/devices/3-3/power/control' # YubiKey expansion card (Framework)
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs'
echo 'auto' > '/sys/block/sda/device/power/control'
# TODO: echo 'auto' > '/sys/bus/usb/devices/1-2/power/control' # One for each USB device
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:0a.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.5/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:2d:00.0/power/control'