]> git.pld-linux.org Git - packages/lm_sensors.git/blobdiff - fancontrol.init
- do not use macro for /etc/sysconfig
[packages/lm_sensors.git] / fancontrol.init
index cfefcc5381d438c552e57e09c195a0358a0336d0..85e5446022809123a5aa6876606ad25ec420b73c 100644 (file)
 # Source function library
 . /etc/rc.d/init.d/functions
 
-# Get service config - may override defaults
-# [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
+# Get service config
+ [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
 
-# See how we were called.
-case "$1" in
-  start)
-       # 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
+start() {
        # 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
                daemon fancontrol
                RETVAL=$?
@@ -39,8 +38,9 @@ case "$1" in
        else
                msg_already_running fancontrol
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/fancontrol ]; then
                # Stop daemons.
                msg_stopping fancontrol
@@ -49,11 +49,23 @@ case "$1" in
        else
                msg_not_running fancontrol
        fi
+}
+
+restart() {
+       stop
+       start
+}
+
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
-       exit $?
+       restart
        ;;
   reload)
        if [ -f /var/lock/subsys/fancontrol ]; then
@@ -61,18 +73,12 @@ case "$1" in
                killproc fancontrol -HUP
                RETVAL=$?
        else
-               msg_not_running fancontrol >&2
+               msg_not_running fancontrol
                RETVAL=7
        fi
        ;;
   force-reload)
-       # if program allows reloading without stopping
-       $0 reload
-
-       # or if it doesn't
-       $0 restart
-
-       exit $?
+       restart
        ;;
   init)
        pwmconfig
This page took 0.091628 seconds and 4 git commands to generate.