for an unknomw reason, my script is not working anymore, the parameters
files are not given to fancontrol, taking /etc/fancontrol all the times

Here is a script to avoid this problem :

#!/bin/sh
#
# Fancontrol start script.
#

set -e

# Defaults
DAEMON=/usr/sbin/fancontrol
PIDFILE=/var/run/fancontrol.pid
PATH=/sbin:/bin:/usr/sbin:/usr/bin


test -f $DAEMON || exit 0

. /lib/lsb/init-functions


case "$1" in
        start)
                cp /etc/fancontrol1 /etc/fancontrol
                log_begin_msg "Starting fancontrol config 1..."
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                sleep 1
                if start-stop-daemon --stop -q -p $PIDFILE ; then
                log_success_msg "redémarrage configuration ok1"
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                exit 0
                else
                rm -f $PIDFILE
                fi

                cp /etc/fancontrol2 /etc/fancontrol
                log_begin_msg "Starting fancontrol config 2..."
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                sleep 1
                if start-stop-daemon --stop -q -p $PIDFILE ; then
                log_success_msg "redémarrage configuration ok2"
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                exit 0
                else
                rm -f $PIDFILE
                fi

                cp /etc/fancontrol3 /etc/fancontrol
                log_begin_msg "Starting fancontrol config 3..."
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                sleep 1
                if start-stop-daemon --stop -q -p $PIDFILE ; then
                log_success_msg "redémarrage configuration ok3"
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                exit 0
                else
                rm -f $PIDFILE
                fi

                cp /etc/fancontrol4 /etc/fancontrol
                log_begin_msg "Starting fancontrol config 4..."
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                sleep 1
                if start-stop-daemon --stop -q -p $PIDFILE ; then
                log_success_msg "redémarrage configuration ok4"
                start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
                log_end_msg $?
                exit 0
                else
                log_success_msg "échec démarrage fancontrol"
                rm -f $PIDFILE
                fi
                ;;
        stop)
                log_begin_msg "Stopping fancontrol daemon..."
                start-stop-daemon --stop -o -q -p $PIDFILE
                log_end_msg $?
                rm -f $PIDFILE
                ;;
        force-reload|restart)
                sh $0 stop
                sh $0 start
                ;;
        *)
                log_success_msg "Usage: /etc/init.d/fancontrol 
{start|stop|restart|force-reload}"
                log_success_msg "  start - starts system-wide fancontrol 
service"
                log_success_msg "  stop  - stops system-wide fancontrol service"
                log_success_msg "  restart, force-reload - starts a new 
system-wide fancontrol service"
                exit 1
                ;;
esac

exit 0

-- 
Fancontrol relies on the module load order
https://bugs.launchpad.net/bugs/576602
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to