PageRenderTime 68ms CodeModel.GetById 64ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/rc2.d/S99ondemand

http://github.com/brinkman83/bashrc
Shell | 40 lines | 26 code | 5 blank | 9 comment | 2 complexity | cc2a79a545967eec1170dc2bb44468e0 MD5 | raw file
 1#! /bin/sh
 2### BEGIN INIT INFO
 3# Provides:          ondemand
 4# Required-Start:    $remote_fs $all
 5# Required-Stop:
 6# Default-Start:     2 3 4 5
 7# Default-Stop:
 8# Short-Description: Set the CPU Frequency Scaling governor to "ondemand"
 9### END INIT INFO
10
11
12PATH=/sbin:/usr/sbin:/bin:/usr/bin
13
14. /lib/init/vars.sh
15. /lib/lsb/init-functions
16
17case "$1" in
18    start)
19    	start-stop-daemon --start --background --exec /etc/init.d/ondemand -- background
20        ;;
21    background)
22	sleep 60 # probably enough time for desktop login
23
24	for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
25	do
26		[ -f $CPUFREQ ] || continue
27		echo -n ondemand > $CPUFREQ
28	done
29	;;
30    restart|reload|force-reload)
31        echo "Error: argument '$1' not supported" >&2
32        exit 3
33        ;;
34    stop)
35        ;;
36    *)
37        echo "Usage: $0 start|stop" >&2
38        exit 3
39        ;;
40esac