Fancontrol запускается вручную, но не работает как сервис

3356
Jason.local

Когда 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 initscript

#! /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
Отправьте сюда initscript (/etc/init.d/fancontrol), чтобы мы могли посмотреть, что происходит во время запуска загрузки. Также опубликуйте, какую ОС вы используете. Несколько быстрых идей: 1) различные переменные ENV 2) команда sudo где-то внутри initscript && requiretty в конфигурации sudo Fiisch 9 лет назад 1
@Fiisch Я на Debian wheezy, и я добавил начальный текст fancontrol. Jason.local 9 лет назад 0
Попробуйте запустить `start-stop-daemon --start --pidfile /var/run/fancontrol.pid --startas / usr / sbin / fancontrol` из своего терминала и опубликовать результаты. Также попробуйте то же самое, но сначала установите то же значение PATH, которое написано в initscript. И, пожалуйста, опубликуйте вывод `which fancontrol` из вашей сессии bash. :) PS: извините за задержку. У меня было много работы. Fiisch 9 лет назад 0

1 ответ на вопрос

0
Jason.local

I feel silly, should've investigated more. Here is the answer just incase I mess this up or anyone else has the same problem. Also, many thanks to @Fiisch for advice and pointing me in the right direction.

When starting fancontrol via #service fancontrol start or #fancontrol, the errors of /usr/sbin/fancontrol are not printed. Due to motherboard limitations, my sensors are defined as absolute paths. So I ran /usr/sbin/fancontrol. This causes the error

Configuration is too old, please run pwmconfig again 

So I decided to take a look at /usr/sbin/fancontrol to see why. I found the cause at lines 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 

Its just a simple configuration change detector! since, I had specified the absolute paths for my sensors, not only was this not necessary, it was actually causing the error. So I just commented it out.

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

That was it! fancontrol works perfectly now and starts at boot time.

Похожие вопросы