Sorry for my english i'm french ^

i've done a starting script in init.d for fancontrol to handle the
different configurations :

First create fancontrol, fancontrol1, fancontrol2 configuration files
for fancontrol with different configurations you can have (you can have
only two or more than three conf files)

then here is the script :

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

set -e

# Defaults
DAEMON=/usr/sbin/fancontrol
PIDFILE=/var/run/fancontrol.pid
PATH=/sbin:/bin:/usr/sbin:/usr/bin
CONFIG1=/etc/fancontol
CONFIG2=/etc/fancontol1
CONFIG3=/etc/fancontol2

test -f $DAEMON || exit 0

. /lib/lsb/init-functions


case "$1" in
        start)
                log_begin_msg "Starting fancontrol config 1..."
                start-stop-daemon --start -o -b -p $PIDFILE -x $DAEMON $CONFIG2
                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 -o -b -p $PIDFILE -x $DAEMON $CONFIG2
                log_end_msg $?
                exit 0
                else
                rm -f $PIDFILE
                fi

                log_begin_msg "Starting fancontrol config 2..."
                start-stop-daemon --start -o -b -p $PIDFILE -x $DAEMON $CONFIG1
                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 -o -b -p $PIDFILE -x $DAEMON $CONFIG1
                log_end_msg $?
                exit 0
                else
                rm -f $PIDFILE
                fi

                log_begin_msg "Starting fancontrol config 3..."
                start-stop-daemon --start -o -b -p $PIDFILE -x $DAEMON $CONFIG3
                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 -o -b -p $PIDFILE -x $DAEMON $CONFIG3
                log_end_msg $?
                exit 0
                else
                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
**************************************

For now then fancontrol daemon always starts without fails....
Hope this could be useful for others
With only one week of linux practice, i'm proud of this script ! ^^

-- 
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