当从终端启动 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 现在运行正常,并在启动时启动。