View Single Post
Posts: 59 | Thanked: 7 times | Joined on Jan 2010
#3541
Originally Posted by sdpkom View Post
Updated script to switch profiles based on temperature

What it does -
Probes the temperature every 30 seconds
If the temperature is higher then 45 degrees, switches to the deafult profile (safety measure).
If the temperature is 40-45 degrees, runs on ideal config, with max =850
If the device is cold, starvs the CPU and let it run till 900MHZ.


#!/bin/sh
set old=""
set limits=""
set oldlimits=""
while test 2 -gt 1;
do
modprobe bq27x00_battery
read tmpr </sys/class/power_supply/bq27200-0/temp
if test $tmpr -gt 45;
then new="default";
limits="250 600";
else
if test $tmpr -gt 40;
then
new="ideal";
limits="500 850";
else
new="starving";
limits="500 900"
fi
fi
if test $old!=$new;
then
/usr/sbin/kernel-config load $new;
/usr/sbin/kernel-config limits $limits;
else if test $limits!=$oldlimits
/usr/sbin/kernel-config limits $limits;
fi
fi
old=$new
oldlimits=$limits
sleep 30
done
this is excellent Can you please help me , how do i run the script ?
I copy paste all these commands on x-terminal? or there is something else i have to do?