#!/bin/sh # Adapted from apmd included in RedHat 8.0 # by John Leach www.johnleach.co.uk # # chkconfig: 2345 26 74 # description: cpufreqd monitors apm information and scales your cpu \ # frequency according to a set of rules. # processname: cpufreqd # Don't bother if /proc/apm doesn't exist, kernel doesn't have # support for APM. [ -e /proc/apm ] || exit 0 # same for /proc/cpufreq [ -e /proc/cpufreq ] || exit 0 # Source function library. . /etc/init.d/functions POLLTIME=120 RETVAL=0 start() { echo -n $"Starting up CPUFREQ daemon: " daemon /usr/local/sbin/cpufreqd -d -p $POLLTIME -f /etc/cpufreqd.conf RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cpufreqd echo } stop() { echo -n $"Shutting down CPUFREQ daemon: " killproc cpufreqd RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cpufreqd echo } dostatus() { status cpufreqd RETVAL=$? } restart() { stop start RETVAL=$? } condrestart() { [ -e /var/lock/subsys/cpufreqd ] && restart || : } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) dostatus ;; restart|reload) restart ;; condrestart) condrestart ;; *) echo "Usage: cpufreqd.init {start|stop|status|restart|reload|condrestart}" exit 1 esac exit $RETVAL