<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tlr</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tlr"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Tlr"/>
	<updated>2026-05-06T02:04:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=7959</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=7959"/>
		<updated>2005-08-13T08:01:03Z</updated>

		<summary type="html">&lt;p&gt;Tlr: fix link formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fan control shell scripts==&lt;br /&gt;
===sh script example===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 MAXTEMP=50&lt;br /&gt;
 &lt;br /&gt;
 while [ 1 ];&lt;br /&gt;
 do&lt;br /&gt;
        fan=no&lt;br /&gt;
 &lt;br /&gt;
        for temp in `sed s/temperatures:// &amp;lt; /proc/acpi/ibm/thermal`&lt;br /&gt;
        do&lt;br /&gt;
                test $temp -gt $MAXTEMP &amp;amp;&amp;amp; fan=yes&lt;br /&gt;
        done&lt;br /&gt;
 &lt;br /&gt;
        command='disable'&lt;br /&gt;
        test &amp;quot;$fan&amp;quot; = &amp;quot;yes&amp;quot; &amp;amp;&amp;amp; command='enable'&lt;br /&gt;
        echo $command &amp;gt; /proc/acpi/ibm/fan&lt;br /&gt;
 &lt;br /&gt;
        sleep 20&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
===sh script with more features===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 # fan control-script&lt;br /&gt;
 #&lt;br /&gt;
 # based upon ibm-acpi 0.11 (experimental=1 !)&lt;br /&gt;
 #&lt;br /&gt;
 # eliminates anoying &amp;quot;fan always on&amp;quot; in battery mode&lt;br /&gt;
 # works with hysteresis (DELTA) so that always-turn-on/turn-off is avoided&lt;br /&gt;
 # fan acivates at MAXTEMP and cools down CPU, GPU etc. to MAXTEMP-DELTA than the fan is turned off&lt;br /&gt;
 # furthermore detects if AC is on and gives back fan control to default behaviour than&lt;br /&gt;
 #&lt;br /&gt;
 # one can change MAXTEMP and DELTA to individual values&lt;br /&gt;
 # but take care of your THINKPAD don`t melt it!&lt;br /&gt;
 #&lt;br /&gt;
 # have fun!&lt;br /&gt;
 # mk 05.05.05&lt;br /&gt;
 &lt;br /&gt;
 MAXTEMP=51&lt;br /&gt;
 DELTA=4&lt;br /&gt;
 &lt;br /&gt;
 SWITCHTEMP=$MAXTEMP&lt;br /&gt;
 &lt;br /&gt;
 #make sure the script doesn't leave the fan off on error&lt;br /&gt;
 trap &amp;quot;echo enable &amp;gt; /proc/acpi/ibm/fan&amp;quot; EXIT&lt;br /&gt;
 &lt;br /&gt;
 while [ 1 ];&lt;br /&gt;
 do&lt;br /&gt;
   for ac in `sed s/state:// &amp;lt; /proc/acpi/ac_adapter/AC/state`&lt;br /&gt;
     do&lt;br /&gt;
      if [ &amp;quot;$ac&amp;quot; = &amp;quot;off-line&amp;quot; ]; then&lt;br /&gt;
          fan=no&lt;br /&gt;
          for temp in `sed s/temperatures:// &amp;lt; /proc/acpi/ibm/thermal`&lt;br /&gt;
            do&lt;br /&gt;
              test $temp -gt $SWITCHTEMP &amp;amp;&amp;amp; fan=yes&lt;br /&gt;
            done&lt;br /&gt;
 &lt;br /&gt;
          if [ &amp;quot;$fan&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
            command='enable'&lt;br /&gt;
            SWITCHTEMP=`expr $MAXTEMP - $DELTA`&lt;br /&gt;
          else&lt;br /&gt;
            SWITCHTEMP=$MAXTEMP&lt;br /&gt;
            command='disable'&lt;br /&gt;
          fi&lt;br /&gt;
 &lt;br /&gt;
        else # ac-adapter on -&amp;gt; set fan control to standard behaviour&lt;br /&gt;
          command='enable'&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        echo $command &amp;gt; /proc/acpi/ibm/fan&lt;br /&gt;
        sleep 15&lt;br /&gt;
      done &lt;br /&gt;
   done&lt;br /&gt;
&lt;br /&gt;
===sh script with extra safety functionality ===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches verious signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 # july 2005 Erik Groeneveld, erik@cq2.nl&lt;br /&gt;
 # It makes sure the fan is on in case of errors&lt;br /&gt;
 # and only turns it off when all temps are ok.&lt;br /&gt;
 &lt;br /&gt;
 IBM_ACPI=/proc/acpi/ibm&lt;br /&gt;
 THERMOMETER=$IBM_ACPI/thermal&lt;br /&gt;
 FAN=$IBM_ACPI/fan&lt;br /&gt;
 MAXTRIPPOINT=65&lt;br /&gt;
 MINTRIPPOINT=60&lt;br /&gt;
 TRIPPOINT=$MINTRIPPOINT&lt;br /&gt;
 &lt;br /&gt;
 echo fancontrol: Thermometer: $THERMOMETER, Fan: $FAN&lt;br /&gt;
 echo fancontrol: Current `cat $THERMOMETER`&lt;br /&gt;
 echo fancontrol: Controlling temperatures between $MINTRIPPOINT and $MAXTRIPPOINT degrees.&lt;br /&gt;
 &lt;br /&gt;
 # Make sure the fan is turned on when the script crashes or is killed&lt;br /&gt;
 trap &amp;quot;echo enable &amp;gt; $FAN; exit 0&amp;quot; HUP KILL INT ABRT STOP QUIT SEGV TERM&lt;br /&gt;
 &lt;br /&gt;
 while [ 1 ];&lt;br /&gt;
 do&lt;br /&gt;
        command=enable&lt;br /&gt;
        temperatures=`sed s/temperatures:// &amp;lt; $THERMOMETER`&lt;br /&gt;
        result=&lt;br /&gt;
        for temp in $temperatures&lt;br /&gt;
        do&lt;br /&gt;
                test $temp -le $TRIPPOINT &amp;amp;&amp;amp; result=$result.Ok&lt;br /&gt;
        done&lt;br /&gt;
        if [ &amp;quot;$result&amp;quot; = &amp;quot;.Ok.Ok.Ok.Ok.Ok.Ok.Ok.Ok&amp;quot; ]; then&lt;br /&gt;
                command=disable&lt;br /&gt;
                TRIPPOINT=$MAXTRIPPOINT&lt;br /&gt;
        else&lt;br /&gt;
                command=enable&lt;br /&gt;
                TRIPPOINT=$MINTRIPPOINT&lt;br /&gt;
        fi&lt;br /&gt;
        echo $command &amp;gt; $FAN&lt;br /&gt;
        # Temperature ramps up quickly, so pick this not too large:&lt;br /&gt;
        sleep 5&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
==Init script example==&lt;br /&gt;
&lt;br /&gt;
 #! /bin/sh&lt;br /&gt;
 &lt;br /&gt;
 N=/etc/init.d/fan&lt;br /&gt;
 &lt;br /&gt;
 set -e&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
  start)&lt;br /&gt;
        # make sure privileges don't persist across reboots&lt;br /&gt;
        if [ -d /var/run/fan ] &amp;amp;&amp;amp; [ &amp;quot;x`ls /var/run/fan`&amp;quot; != x ]&lt;br /&gt;
        then&lt;br /&gt;
                touch -t 198501010000 /var/run/fan/*&lt;br /&gt;
        fi&lt;br /&gt;
        fan.sh &amp;amp;    # Script from above&lt;br /&gt;
        ;;&lt;br /&gt;
  stop|reload|restart|force-reload)&lt;br /&gt;
        killall fan.sh&lt;br /&gt;
        echo enable &amp;gt; /proc/acpi/ibm/fan&lt;br /&gt;
        ;;&lt;br /&gt;
  *)&lt;br /&gt;
        echo &amp;quot;Usage: $N {start|stop|restart|force-reload}&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
        exit 1&lt;br /&gt;
        ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==fanctrld==&lt;br /&gt;
&lt;br /&gt;
[http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html fanctrld] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Tlr</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=7703</id>
		<title>Fan control scripts</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Fan_control_scripts&amp;diff=7703"/>
		<updated>2005-08-13T08:00:17Z</updated>

		<summary type="html">&lt;p&gt;Tlr: Add link to fanctrld&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fan control shell scripts==&lt;br /&gt;
===sh script example===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 MAXTEMP=50&lt;br /&gt;
 &lt;br /&gt;
 while [ 1 ];&lt;br /&gt;
 do&lt;br /&gt;
        fan=no&lt;br /&gt;
 &lt;br /&gt;
        for temp in `sed s/temperatures:// &amp;lt; /proc/acpi/ibm/thermal`&lt;br /&gt;
        do&lt;br /&gt;
                test $temp -gt $MAXTEMP &amp;amp;&amp;amp; fan=yes&lt;br /&gt;
        done&lt;br /&gt;
 &lt;br /&gt;
        command='disable'&lt;br /&gt;
        test &amp;quot;$fan&amp;quot; = &amp;quot;yes&amp;quot; &amp;amp;&amp;amp; command='enable'&lt;br /&gt;
        echo $command &amp;gt; /proc/acpi/ibm/fan&lt;br /&gt;
 &lt;br /&gt;
        sleep 20&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
===sh script with more features===&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 # fan control-script&lt;br /&gt;
 #&lt;br /&gt;
 # based upon ibm-acpi 0.11 (experimental=1 !)&lt;br /&gt;
 #&lt;br /&gt;
 # eliminates anoying &amp;quot;fan always on&amp;quot; in battery mode&lt;br /&gt;
 # works with hysteresis (DELTA) so that always-turn-on/turn-off is avoided&lt;br /&gt;
 # fan acivates at MAXTEMP and cools down CPU, GPU etc. to MAXTEMP-DELTA than the fan is turned off&lt;br /&gt;
 # furthermore detects if AC is on and gives back fan control to default behaviour than&lt;br /&gt;
 #&lt;br /&gt;
 # one can change MAXTEMP and DELTA to individual values&lt;br /&gt;
 # but take care of your THINKPAD don`t melt it!&lt;br /&gt;
 #&lt;br /&gt;
 # have fun!&lt;br /&gt;
 # mk 05.05.05&lt;br /&gt;
 &lt;br /&gt;
 MAXTEMP=51&lt;br /&gt;
 DELTA=4&lt;br /&gt;
 &lt;br /&gt;
 SWITCHTEMP=$MAXTEMP&lt;br /&gt;
 &lt;br /&gt;
 #make sure the script doesn't leave the fan off on error&lt;br /&gt;
 trap &amp;quot;echo enable &amp;gt; /proc/acpi/ibm/fan&amp;quot; EXIT&lt;br /&gt;
 &lt;br /&gt;
 while [ 1 ];&lt;br /&gt;
 do&lt;br /&gt;
   for ac in `sed s/state:// &amp;lt; /proc/acpi/ac_adapter/AC/state`&lt;br /&gt;
     do&lt;br /&gt;
      if [ &amp;quot;$ac&amp;quot; = &amp;quot;off-line&amp;quot; ]; then&lt;br /&gt;
          fan=no&lt;br /&gt;
          for temp in `sed s/temperatures:// &amp;lt; /proc/acpi/ibm/thermal`&lt;br /&gt;
            do&lt;br /&gt;
              test $temp -gt $SWITCHTEMP &amp;amp;&amp;amp; fan=yes&lt;br /&gt;
            done&lt;br /&gt;
 &lt;br /&gt;
          if [ &amp;quot;$fan&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
            command='enable'&lt;br /&gt;
            SWITCHTEMP=`expr $MAXTEMP - $DELTA`&lt;br /&gt;
          else&lt;br /&gt;
            SWITCHTEMP=$MAXTEMP&lt;br /&gt;
            command='disable'&lt;br /&gt;
          fi&lt;br /&gt;
 &lt;br /&gt;
        else # ac-adapter on -&amp;gt; set fan control to standard behaviour&lt;br /&gt;
          command='enable'&lt;br /&gt;
        fi&lt;br /&gt;
 &lt;br /&gt;
        echo $command &amp;gt; /proc/acpi/ibm/fan&lt;br /&gt;
        sleep 15&lt;br /&gt;
      done &lt;br /&gt;
   done&lt;br /&gt;
&lt;br /&gt;
===sh script with extra safety functionality ===&lt;br /&gt;
ibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:&lt;br /&gt;
# It catches verious signals and turns the fan on before it quits.&lt;br /&gt;
# It turns off the fan under very strict conditions, leaving it on when unexpected errors occur.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 # july 2005 Erik Groeneveld, erik@cq2.nl&lt;br /&gt;
 # It makes sure the fan is on in case of errors&lt;br /&gt;
 # and only turns it off when all temps are ok.&lt;br /&gt;
 &lt;br /&gt;
 IBM_ACPI=/proc/acpi/ibm&lt;br /&gt;
 THERMOMETER=$IBM_ACPI/thermal&lt;br /&gt;
 FAN=$IBM_ACPI/fan&lt;br /&gt;
 MAXTRIPPOINT=65&lt;br /&gt;
 MINTRIPPOINT=60&lt;br /&gt;
 TRIPPOINT=$MINTRIPPOINT&lt;br /&gt;
 &lt;br /&gt;
 echo fancontrol: Thermometer: $THERMOMETER, Fan: $FAN&lt;br /&gt;
 echo fancontrol: Current `cat $THERMOMETER`&lt;br /&gt;
 echo fancontrol: Controlling temperatures between $MINTRIPPOINT and $MAXTRIPPOINT degrees.&lt;br /&gt;
 &lt;br /&gt;
 # Make sure the fan is turned on when the script crashes or is killed&lt;br /&gt;
 trap &amp;quot;echo enable &amp;gt; $FAN; exit 0&amp;quot; HUP KILL INT ABRT STOP QUIT SEGV TERM&lt;br /&gt;
 &lt;br /&gt;
 while [ 1 ];&lt;br /&gt;
 do&lt;br /&gt;
        command=enable&lt;br /&gt;
        temperatures=`sed s/temperatures:// &amp;lt; $THERMOMETER`&lt;br /&gt;
        result=&lt;br /&gt;
        for temp in $temperatures&lt;br /&gt;
        do&lt;br /&gt;
                test $temp -le $TRIPPOINT &amp;amp;&amp;amp; result=$result.Ok&lt;br /&gt;
        done&lt;br /&gt;
        if [ &amp;quot;$result&amp;quot; = &amp;quot;.Ok.Ok.Ok.Ok.Ok.Ok.Ok.Ok&amp;quot; ]; then&lt;br /&gt;
                command=disable&lt;br /&gt;
                TRIPPOINT=$MAXTRIPPOINT&lt;br /&gt;
        else&lt;br /&gt;
                command=enable&lt;br /&gt;
                TRIPPOINT=$MINTRIPPOINT&lt;br /&gt;
        fi&lt;br /&gt;
        echo $command &amp;gt; $FAN&lt;br /&gt;
        # Temperature ramps up quickly, so pick this not too large:&lt;br /&gt;
        sleep 5&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
==Init script example==&lt;br /&gt;
&lt;br /&gt;
 #! /bin/sh&lt;br /&gt;
 &lt;br /&gt;
 N=/etc/init.d/fan&lt;br /&gt;
 &lt;br /&gt;
 set -e&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
  start)&lt;br /&gt;
        # make sure privileges don't persist across reboots&lt;br /&gt;
        if [ -d /var/run/fan ] &amp;amp;&amp;amp; [ &amp;quot;x`ls /var/run/fan`&amp;quot; != x ]&lt;br /&gt;
        then&lt;br /&gt;
                touch -t 198501010000 /var/run/fan/*&lt;br /&gt;
        fi&lt;br /&gt;
        fan.sh &amp;amp;    # Script from above&lt;br /&gt;
        ;;&lt;br /&gt;
  stop|reload|restart|force-reload)&lt;br /&gt;
        killall fan.sh&lt;br /&gt;
        echo enable &amp;gt; /proc/acpi/ibm/fan&lt;br /&gt;
        ;;&lt;br /&gt;
  *)&lt;br /&gt;
        echo &amp;quot;Usage: $N {start|stop|restart|force-reload}&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
        exit 1&lt;br /&gt;
        ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==fanctrld==&lt;br /&gt;
&lt;br /&gt;
[fanctrld http://log.does-not-exist.org/archives/2005/08/13/2043_t_43_fan_control_daemon.html] is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Tlr</name></author>
		
	</entry>
</feed>