thelaptopkiller
Joined: 25 Oct 2009 Posts: 67 Location: The only place in tornado ally with no tornadoes
Posted: Sat 31 Oct 2009, 10:06 Post subject:
Question re a CPU throttling script
I have been working on a cpu throttling script(no duh).
But I need a commandline version of the cpu throddler program in 4.3.2.
The code is
Code:
#$/bin/bash
#this is a forever loop
done1="no"
done2="no"
modprobe fan
modprobe thermal #NEED this for script to work
loop="0"
while $loop = "o" do
temp=`cat /proc/acpi/thermal_zone/THRM/temperature`
if [ $temp > "80 C" ] ; then
if [ $done1 = "no" ] ; then
#so if the cpu(s) get to 80 c then the thoddler app would
#lower the speed.
#command for cpu throddler app here
done1="yes"
done2="no"
fi
fi
if [ $temp > "75 C" ] ; then
if [ $done2 = "no" ] ; then
#so if the cpu(s) get to 75 c then the thoddler app would
#increase the speed.
#command for cpu throddler app here
done2="yes"
done1="no"
fi
fi
loop
Think this will work coding wise?
I cant try it et because im still working on getting 4.3.2 to work
A couple of obvious problems:
#$/bin/bash
should be:
#!/bin/bash
while $loop = "o" do
should be:
while [ $loop = "0" ] ; do
but since it is an infinte loop you can just do this:
while : ; do
You'll want to put a sleep command in there somewhere, otherwise this loop will run as fast as your processor will let it go. use a sleep to make itstop after checking/adjusting so that it waits some time before checking again. the longer you sleep the less resources this thing will use -probably 5-30 seconds would be adequate
You may need to elimnate the ' C' from the temp measured so taht shell math can really tell if temp is greater than something:
temp=`cat /proc/acpi/thermal_zone/THRM/temperature |cut -f -d' '`
then:
if [ $temp -gt 80 ] ; then
The word is 'throttle' in case you need to search for programs, etc.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum