My rc.local File

Fri, Jun 5, 2020 2-minute read

It’s no secret that when it comes to Linux distributions, I prefer Slackware. Partially that’s because Slackware feels the most Unix-like out of all of the distributions I’ve used over the years. I got my first taste of Unix with Solaris, and Slackware is the distribution that provides me with anything close to that same feeling. Over the past few months I’ve been using FreeBSD on my laptop, but I’m back to Slack now, and I feel like documenting a few of the tweaks I’ve made to my system. Without any further ado, here’s what’s currently in my /etc/rc.d/rc.local file:

#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

# Set the CPU governors to powersave.
for i in 0 1 2 3; do
	cpufreq-set -c $i -g powersave;
done

# This prevents mouse jitter from waking up my system from sleep.
echo IGBE > /proc/acpi/wakeup
echo XHCI > /proc/acpi/wakeup
echo EHC1 > /proc/acpi/wakeup
echo EHC2 > /proc/acpi/wakeup

powertop --auto-tune

# Don't auto-suspend my mouse. Do everything else powertop
# recommends though.
for d in /sys/bus/usb/devices/*; do
	if [ -e $d/manufacturer ]; then
		if grep -q Logitech $d/manufacturer ; then
			echo 'on' > $d/power/control;
		fi;
	fi;
done

My laptop is a Thinkpad x230, with a Logitech mouse constantly plugged into it. Some of the acpi tweaks will probably need to be modified to suit your hardware.