# damadge could occur. For this, be sure, to run init first
# and be sure the configuration is correct.
#
-# $Id$
-#
# TODO:
# - check this, case this is my first 'advanced' init script
# - maybe add some more stop control, like re-running fancontrol and killing
start() {
# sensors deamon needs to be started
# or at least proper modules loaded (provided by sensorsd deamon)
- if [ -f /var/lock/subsys/sensord ]; then
- # Check if the service is already running?
- if [ ! -f /var/lock/subsys/fancontrol ]; then
- # Fancontrol needs to check system for pwm control
- if [ ! -f /etc/sysconfig/fancontrol ]; then
- nls "Fancontrol not initialized."
- nls "Try \`%s init' before start." "$0"
- exit 6
- fi
-
- msg_starting fancontrol
- # won't start without an output
- daemon --fork 'fancontrol >/dev/null'
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
- else
- msg_already_running fancontrol
- fi
- else
+ if [ ! -f /var/lock/subsys/sensord ]; then
echo "Start sensors daemon first"
- exit 1
+ RETVAL=1
+ return
+ fi
+
+ # Check if the service is already running?
+ if [ -f /var/lock/subsys/fancontrol ]; then
+ msg_already_running fancontrol
+ return
+ fi
+
+ # Fancontrol needs to check system for pwm control
+ if [ ! -f /etc/sysconfig/fancontrol ]; then
+ nls "Fancontrol not initialized."
+ nls "Try \`%s init' before start." "$0"
+ exit 6
fi
+
+ msg_starting fancontrol
+ # won't start without an output
+ daemon --fork 'fancontrol >/dev/null'
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fancontrol
}
stop() {
- if [ -f /var/lock/subsys/fancontrol ]; then
- # Stop daemons.
- msg_stopping fancontrol
- # it's crucial to be sure it ended ok, otherwise we get
- # the fans set and the computer working without any control
- # and that could cause MASSIVE damage
- killproc --waitforname fancontrol --waitfortime 30 fancontrol -TERM
- rm -f /var/lock/subsys/fancontrol
- else
+ if [ ! -f /var/lock/subsys/fancontrol ]; then
msg_not_running fancontrol
+ return
fi
+
+ # Stop daemons.
+ msg_stopping fancontrol
+ # it's crucial to be sure it ended ok, otherwise we get
+ # the fans set and the computer working without any control
+ # and that could cause MASSIVE damage
+ killproc --waitforname fancontrol --waitfortime 30 fancontrol -TERM
+ rm -f /var/lock/subsys/fancontrol
}
restart() {
# See how we were called.
case "$1" in
start)
- start
+ start
;;
stop)
- stop
+ stop
;;
restart)
- restart
+ restart
;;
init)
- pwmconfig
- exit $?
- ;;
+ pwmconfig
+ exit $?
+ ;;
status)
status fancontrol
RETVAL=$?
;;
*)
- msg_usage "$0 {start|stop|restart|status|init}"
+ msg_usage "$0 {start|stop|restart|init|status}"
exit 3
esac
exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh