Skip to content

Instantly share code, notes, and snippets.

@basilfx
Last active August 29, 2015 13:57
Show Gist options
  • Save basilfx/9438078 to your computer and use it in GitHub Desktop.
Save basilfx/9438078 to your computer and use it in GitHub Desktop.
Ubuntu 14.04 Powersave NAS
GRUB_CMDLINE_LINUX_DEFAULT="drm.vblankoffdelay=1 intel_pstate=enable"
#!/bin/bash
### BEGIN INIT INFO
# Provides: powersave
# Required-Start: $remote_fs $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: enable power saving
# Description: enable power saving features for devices
### END INIT INFO
# Run as root
if [ $EUID -ne 0 ]; then
echo "$0 must be run as root"
exit 1
fi
# Disable console cursor blinking
echo 0 > /sys/class/graphics/fbcon/cursor_blink
# Disable NMI
echo 0 | tee /proc/sys/kernel/nmi_watchdog > /dev/null
# Increase VM disk activity writeback
echo 1500 | tee /proc/sys/vm/dirty_writeback_centisecs > /dev/null
# Set disks to laptop mode
echo 5 | tee /proc/sys/vm/laptop_mode > /dev/null
# Tune devices for power save
echo auto | tee /sys/bus/*/devices/*/power/control > /dev/null
echo min_power | tee /sys/class/scsi_host/host*/link_power_management_policy > /dev/null
# Write to file to show it's enabled
touch /tmp/powersaved
# Done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment