j'avait fait une feature request et du coup je vais y mettre un lien vers ici parceque le texte du script ressemble plus a rien sans quoi...
Code : Tout sélectionner
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# source application-specific settings
[ -f /etc/conf.d/cpufreq ] && . /etc/conf.d/cpufreq
case "$1" in
start)
stat_busy "Setting cpufreq governing rules"
params=""
if [ -n $governor ]; then
mod="cpufreq_$governor"
modprobe $mod > /dev/null 2>&1
params="-g $governor"
if [ $? -eq 0 ]; then
#################################################
#find how many processors have to be set
#where
cpu_location='/sys/devices/system/cpu/'
#count in a temp file (this help me to correctly handle `ls` output)
`touch temp_cpu_$$`
`ls $cpu_location > temp_cpu_$$`
#list just the directories in $cpu_tab[]
declare -i cpu_index
cpu_index=0
while read temp_cpu_line;
do
[ -d "$cpu_location$temp_cpu_line" ] && cpu_tab[$cpu_index]=$temp_cpu_line && cpu_index+=1
done < temp_cpu_$$
#kill the temp file
rm temp_cpu_$$
#################################################
if [ "$min_freq" != "" ]; then
params="$params -d $min_freq"
fi
if [ "$max_freq" != "" ]; then
params="$params -u $max_freq"
fi
else
stat_busy " Cannot load governor module '$governor'"
stat_fail
exit
fi
fi
if [ "$params" != "" ]; then
#################################################
#set for each cpu in $cpu_tab[]
cpu_index=0
for a_cpu in "${cpu_tab[@]}"
do
`cpufreq-set --cpu $cpu_index $params`
cpu_index+=1
done
#################################################
#cpufreq-set $params
stat_done
else
stat_busy " Invalid configuration in /etc/conf.d/cpufreq"
stat_fail
fi
;;
stop)
# nothing to do
;;
restart)
$0 start
;;
set)
# TODO: make callable... "cpufreq set 800MHz"
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0