How to control fan speed (lm-sensors) in Ubuntu

Posted in:Tips 'n Tricks
         pwmconfig
  • If you can control fan speeds, great. Now create a file called /etc/init.d/fancontrol, and paste in the following
         #!/bin/sh
         #
         # Fancontrol start script.
         #

         set -e

         # Defaults
         DAEMON=/usr/sbin/fancontrol
         PIDFILE=/var/run/fancontrol-pid
         PATH=/sbin:/bin:/usr/sbin:/usr/bin

         test -f $DAEMON || exit 0

         . /lib/lsb/init-functions


         case "$1" in
              start)
                 log_begin_msg "Starting fancontrol daemon..."
                 start-stop-daemon --start -o -q -m -b -p $PIDFILE -x $DAEMON
                 log_end_msg $?
                 ;;
              stop)
                 log_begin_msg "Stopping fancontrol daemon..."
                 start-stop-daemon --stop -o -q -p $PIDFILE -x $DAEMON
                 log_end_msg $?
                 ;;
             force-reload|restart)
               sh $0 stop
               sh $0 start
               ;;
            *)
               log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload}"
               log_success_msg "  start - starts system-wide fancontrol service"
               log_success_msg "  stop  - stops system-wide fancontrol service"
               log_success_msg "  restart, force-reload - starts a new system-wide fancontrol service"
               exit 1
               ;;
        esac

        exit 0
  • Make it excutable
       sudo chmod +x /etc/init.d/fancontrol
  • Test it
        /etc/init.d/fancontrol start

         and

        /etc/init.d/fancontrol stop
  • If it works fine, autoload it when you reboot. Insert the following line into /etc/rc.local, before "exit 0"
        /etc/init.d/fancontrol start

Content Courtesy: http://www.ubuntuguide.org
Content License:http://www.gnu.org/copyleft/fdl.htm

Press the button below if you liked this site.
webmaster's picture

The brains or the lack of it behind Ubuntu Manual. Crazy about Linux, hates windows except for the fact that it runs many of his favorite games by default. Loves blogging

writeforus