Fancontrol 手動啟動但服務失敗

Fancontrol 手動啟動但服務失敗

當從終端啟動 fancontrol 時,它工作正常

# fancontrol
Loading configuration from /etc/fancontrol ...

Common settings:
  INTERVAL=2

Settings for /sys/devices/platform/it87.656/hwmon/hwmon[[:print:]]*/device/pwm1:
  Depends on /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon[[:print:]]*/device/temp1_input
  Controls /sys/devices/platform/it87.656/hwmon/hwmon[[:print:]]*/device/fan1_input
  MINTEMP=17
  MAXTEMP=53
  MINSTART=140
  MINSTOP=50
  MINPWM=0
  MAXPWM=255

Settings for /sys/devices/platform/it87.656/hwmon/hwmon[[:print:]]*/device/pwm3:
  Depends on /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon[[:print:]]*/device/temp1_input
  Controls /sys/devices/platform/it87.656/hwmon/hwmon[[:print:]]*/device/fan2_input
  MINTEMP=17
  MAXTEMP=55
  MINSTART=140
  MINSTOP=50
  MINPWM=0
  MAXPWM=255

Enabling PWM on fans...
Starting automatic fan control...

但是,當將 fancontrol 作為服務啟動時(啟動時或啟動後),它會失敗。

# service fancontrol start
[ ok ] Starting fan speed regulator: fancontrol.
# service fancontrol status
[FAIL] fancontrol is not running ... failed!

將 fancontrol 作為服務啟動與手動啟動(導致其失敗)之間有什麼區別?

Debian Wheezy Fancontrol 初始化腳本

#! /bin/sh

### BEGIN INIT INFO
# Provides:          fancontrol
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: fancontrol
# Description:       fan speed regulator
### END INIT INFO

. /lib/lsb/init-functions

[ -f /etc/default/rcS ] && . /etc/default/rcS
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/fancontrol
DESC="fan speed regulator"
NAME="fancontrol"
PIDFILE=/var/run/fancontrol.pid
CONF=/etc/fancontrol

test -x $DAEMON || exit 0

case "$1" in
  start)
    if [ -f $CONF ] ; then
        if $DAEMON --check 1>/dev/null 2>/dev/null ; then
            log_daemon_msg "Starting $DESC" "$NAME"
            start-stop-daemon --start --quiet --background --pidfile $PIDFILE --startas $DAEMON
            log_end_msg $?
        else
            log_failure_msg "Not starting fancontrol, broken configuration file; please re-run pwmconfig."
        fi
    else
        if [ "$VERBOSE" != no ]; then
            log_warning_msg "Not starting fancontrol; run pwmconfig first."
        fi
    fi
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" "$NAME"
    start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --startas $DAEMON
    rm -f $PIDFILE
    log_end_msg $?
    ;;
  restart)
    $0 stop

答案1

我覺得自己很傻,應該多調查一下。這是答案,以防萬一我搞砸了或其他人也遇到了同樣的問題。另外,非常感謝@Fiisch 的建議並為我指明了正確的方向。

#service fancontrol start當通過或啟動 fancontrol 時#fancontrol,不會印出 /usr/sbin/fancontrol 的錯誤。由於主機板限制,我的感測器被定義為絕對路徑。所以我跑了/usr/sbin/fancontrol。這會導致錯誤

Configuration is too old, please run pwmconfig again

所以我決定看一下 /usr/sbin/fancontrol 看看為什麼。我在第302-307行找到了原因:

# Check for configuration change
if [ -z "$DEVPATH" -o -z "$DEVNAME" ]
then
    echo "Configuration is too old, please run pwmconfig again" >&2
    exit 1
fi

它只是一個簡單的配置更改檢測器!因為,我已經為我的感測器指定了絕對路徑,這不僅沒有必要,而且實際上導致了錯誤。所以我就把它註解掉了。

## Check for configuration change
#if [ -z "$DEVPATH" -o -z "$DEVNAME" ]
#then
#   echo "Configuration is too old, please run pwmconfig again" >&2
#   exit 1
#fi

就是這樣! fancontrol 現在工作正常並在啟動時啟動。

相關內容