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
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 /usr/sbin/ fancontrol /var/run/ fancontrol. pid /bin:/usr/ sbin:/usr/ bin
DAEMON=
PIDFILE=
PATH=/sbin:
test -f $DAEMON || exit 0
. /lib/lsb/ init-functions
case "$1" in
log_begin_ msg "Starting fancontrol config 1..."
start- stop-daemon --start -b -p $PIDFILE -x $DAEMON
log_success_ msg "redémarrage configuration ok1"
log_end_ msg $?
start)
cp /etc/fancontrol1 /etc/fancontrol
log_end_msg $?
sleep 1
if start-stop-daemon --stop -q -p $PIDFILE ; then
start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
exit 0
else
rm -f $PIDFILE
fi
cp /etc/fancontrol2 /etc/fancontrol
start- stop-daemon --start -b -p $PIDFILE -x $DAEMON
log_success_ msg "redémarrage configuration ok2"
log_end_ msg $?
log_begin_msg "Starting fancontrol config 2..."
log_end_msg $?
sleep 1
if start-stop-daemon --stop -q -p $PIDFILE ; then
start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
exit 0
else
rm -f $PIDFILE
fi
cp /etc/fancontrol3 /etc/fancontrol
start- stop-daemon --start -b -p $PIDFILE -x $DAEMON
log_success_ msg "redémarrage configuration ok3"
log_end_ msg $?
log_begin_msg "Starting fancontrol config 3..."
log_end_msg $?
sleep 1
if start-stop-daemon --stop -q -p $PIDFILE ; then
start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
exit 0
else
rm -f $PIDFILE
fi
cp /etc/fancontrol4 /etc/fancontrol
start- stop-daemon --start -b -p $PIDFILE -x $DAEMON
log_success_ msg "redémarrage configuration ok4"
log_end_ msg $?
log_begin_ msg "Stopping fancontrol daemon..."
start- stop-daemon --stop -o -q -p $PIDFILE
log_end_ msg $?
force- reload| restart)
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
log_begin_msg "Starting fancontrol config 4..."
log_end_msg $?
sleep 1
if start-stop-daemon --stop -q -p $PIDFILE ; then
start-stop-daemon --start -b -p $PIDFILE -x $DAEMON
exit 0
else
log_success_msg "échec démarrage fancontrol"
rm -f $PIDFILE
fi
;;
stop)
rm -f $PIDFILE
;;
sh $0 stop
sh $0 start
;;
*)
;;
esac
exit 0