Created
March 17, 2014 12:48
-
-
Save kung-foo/9598618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: ondemand | |
# Required-Start: $remote_fs $all | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: | |
# Short-Description: Set the CPU Frequency Scaling governor to "ondemand" | |
### END INIT INFO | |
PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
. /lib/init/vars.sh | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
start-stop-daemon --start --background --exec /etc/init.d/ondemand -- background | |
;; | |
background) | |
sleep 60 # probably enough time for desktop login | |
for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | |
do | |
[ -f $CPUFREQ ] || continue | |
echo -n ondemand > $CPUFREQ | |
done | |
;; | |
restart|reload|force-reload) | |
echo "Error: argument '$1' not supported" >&2 | |
exit 3 | |
;; | |
stop) | |
;; | |
*) | |
echo "Usage: $0 start|stop" >&2 | |
exit 3 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment