aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSepero <sepero111@gmail.com>2015-01-31 17:49:26 -0500
committerSepero <sepero111@gmail.com>2015-01-31 17:49:26 -0500
commit5ddf325c455995bce084a560b3cfc56e41367d62 (patch)
tree0283f924a26b189faba57aa1c0002cbdcd1ceaa1
parent5e90b1346e0451a8436f665cec2d270f11849db4 (diff)
Added support for cpufreq-set from cpufrequtilities package.
-rwxr-xr-xtemp_throttle.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/temp_throttle.sh b/temp_throttle.sh
index 23ce151..57686ce 100755
--- a/temp_throttle.sh
+++ b/temp_throttle.sh
@@ -2,7 +2,7 @@
# Usage: temp_throttle.sh max_temp
# USE CELSIUS TEMPERATURES.
-# version 2.11
+# version 2.20
cat << EOF
Author: Sepero 2013 (sepero 111 @ gmx . com)
@@ -104,7 +104,12 @@ set_freq () {
FREQ_TO_SET=$(echo $FREQ_LIST | cut -d " " -f $CURRENT_FREQ)
echo $FREQ_TO_SET
for i in $(seq 0 $CORES); do
- echo $FREQ_TO_SET > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq
+ # Try to set core frequency by writing to /sys/devices.
+ { echo $FREQ_TO_SET 2> /dev/null > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq; } ||
+ # Else, try to set core frequency using command cpufreq-set.
+ { cpufreq-set -c $i --max $FREQ_TO_SET > /dev/null; } ||
+ # Else, return error message.
+ { err_exit "Failed to set frequency CPU core$i. Run script as Root user. Some systems may require to install the package cpufrequtils."; }
done
}