You are not logged in.

#1 2007-11-03 03:34:16

steve_v
Member
Registered: 2006-02-11
Posts: 80

/etc/rc.d/fancontrol from lm_sensors is broken, here is a fix :-)

The fancontrol rc script from the lm_sensors package tries to run /usr/sbin/fancontrol in the current shell,

[ -z "$PID" ] && /usr/sbin/fancontrol

where the script should be backgrounded. This hangs the boot process.

[ -z "$PID" ] && exec /usr/sbin/fancontrol > /dev/null &

works and also supresses some annoying output text not in keeping with the boot process.

Said script also uses

PID=`pidof -o %PPID /usr/sbin/fancontrol`

which returns nothing as /usr/sbin/fancontrol is not a binary.

PID=`pidof -o %PPID -x /usr/sbin/fancontrol`

works.

It would be nice if this made it into the package so I don't have to fix it every time I sync. :-)

Complete working script:

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pidof -o %PPID -x /usr/sbin/fancontrol`
case "$1" in
  start)
    stat_busy "Starting fancontrol"
    [ -z "$PID" ] && exec /usr/sbin/fancontrol > /dev/null &
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon fancontrol
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping fancontrol"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon fancontrol
      stat_done
    fi
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Cheers,

Steve.

Offline

#2 2007-11-03 08:00:21

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: /etc/rc.d/fancontrol from lm_sensors is broken, here is a fix :-)

Thanks for the input. Please post your amendment in the bugtracker, where it will definitely be seen - Arch devs don't always have the time to visit the forum.

Offline

#3 2007-12-03 08:53:28

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: /etc/rc.d/fancontrol from lm_sensors is broken, here is a fix :-)

Has this been fixed? smile

Offline

Board footer

Powered by FluxBB