LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Starting fancontrol at boot (https://www.linuxquestions.org/questions/slackware-14/starting-fancontrol-at-boot-4175625701/)

Danodare 03-16-2018 12:44 PM

Starting fancontrol at boot
 
I added the following line to my etc/rc.d/rc.local

Code:

/usr/sbin/fancontrol
and at the end of the boot sequence, fancontrol started, and stopped the boot sequence. I couldn't log in and I was forced to boot from the slackware dvd and manually delete rc.local to be able to boot again.

fancontrol works fine when I start it from a terminal.

Is there a way to start it at boot without stopping the boot sequence ?

Thanks in advance for any help,
-Danodare

Didier Spaier 03-16-2018 01:27 PM

Try:
Code:

/usr/sbin/fancontrol &

upnort 03-16-2018 05:34 PM

Perhaps for more ganular control:

Code:

#!/bin/sh
# /etc/rc.d/rc.fancontrol

# Start/stop/restart fancontrol.

# Start fancontrol:
fancontrol_start() {
  if [ -x /usr/sbin/fancontrol ]; then
    echo "Starting PWM fancontrol: /usr/sbin/fancontrol"
    if [ "`ps ax | grep /usr/sbin/fancontrol | grep -v grep`" = "" ]; then
      /usr/sbin/fancontrol &
    else
      echo "/usr/sbin/fancontrol is already running."
    fi
  else
    echo "/usr/sbin/fancontrol is not executable or is not installed."
  fi
}

# Stop fancontrol:
fancontrol_stop() {
  echo "Stopping PWM fancontrol."
  if [ -r /var/run/fancontrol.pid ]; then
    kill -9 $(cat /var/run/fancontrol.pid) 2>/dev/null
  else
    killall /usr/sbin/fancontrol 2>/dev/null
  fi
}

# Restart fancontrol:
fancontrol_restart() {
  fancontrol_stop
  sleep .5
  fancontrol_start
}

case "$1" in
  'start')
    fancontrol_start
    ;;
  'stop')
    fancontrol_stop
    ;;
  'restart')
    fancontrol_restart
    ;;
*)
  echo "Usage: $0 start|stop|restart"
  exit 1
esac

In rc.local:

Code:

if [ -x /etc/rc.d/rc.fancontrol ]; then
  /etc/rc.d/rc.fancontrol start
fi

In rc.local_shutdown:

Code:

if [ -x /etc/rc.d/rc.fancontrol ]; then
  /etc/rc.d/rc.fancontrol stop
fi


Danodare 03-17-2018 06:27 AM

Thank you ! It worked. At first, it only worked randomly because hwmon symlinks got randomly switched on reboots. Then I changed my /etc/fancontrol to

Code:

INTERVAL=100
FCTEMPS=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm2=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp1_input /sys/devices/platform/nct6775.656/hwmon/hwmon[[:pr
int:]]*/pwm1=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp1_input
FCFANS=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm2=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/fan2_input /sys/devices/platform/nct6775.656/hwmon/hwmon[[:pri
nt:]]*/pwm1=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/fan1_input
MINTEMP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm2=40 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm1=40
MAXTEMP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm2=60 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm1=60
MINSTART=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm2=150 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm1=60
MINSTOP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm2=0 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm1=40
MINPWM=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm1=0
MAXPWM=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm2=255 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm1=255

And after that, it worked on all reboots.


All times are GMT -5. The time now is 03:42 PM.