]> git.pld-linux.org Git - packages/lm_sensors.git/blobdiff - sensors.init
- use functions
[packages/lm_sensors.git] / sensors.init
index 80f36dab1c790eccc36b3a852bd13cfc9e4e0866..f86f47fb16ad4b1e81bb301acd6b2ac926863397 100644 (file)
@@ -16,30 +16,15 @@ if [ -f /etc/sysconfig/sensors ]; then
        . /etc/sysconfig/sensors
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
+       if [ ! -f /var/lock/subsys/sensors_modules ]; then
+               msg_starting "sensors daemon"; fail
+               nls "sensors_modules services not started" >&2
+               exit 6
+       fi
+       
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/sensors ]; then
-               if [ -z "$BUS" ] || [ -z "$CHIP" ]; then 
-                       msg_starting "sensors daemon"; fail
-                       nls "BUS or CHIP not configured in /etc/sysconfig/sensors" >&2
-                       exit 6
-               fi
-
-               # insert modules
-               for i in $BUS; do
-                       _modprobe single die "i2c-$i"
-               done
-               for i in $CHIP; do
-                       _modprobe single die "$i"
-               done
-
-               if [ "$SENSORS_SET" = "1" ]; then
-                       sensors -s
-               fi
-
                msg_starting "sensors daemon"
                daemon sensord \
                        $([ -n "$INTERVAL" ] && echo "-i $INTERVAL") \
@@ -54,24 +39,26 @@ case "$1" in
        else
                msg_already_running "sensors daemon"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/sensors ]; then
                msg_stopping "sensors daemon"
                killproc sensord
-
-               # remove kernel modules
-               for i in $CHIP; do
-                       /sbin/rmmod $i >/dev/null 2>&1
-               done
-               for i in $BUS; do
-                       /sbin/rmmod i2c-$BUS >/dev/null 2>&1
-               done
-
                rm -f /var/lock/subsys/sensors
        else
                msg_not_running "sensors daemon"
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   status)
        status sensors sensord
@@ -79,9 +66,8 @@ case "$1" in
        sensors
        ;;
   restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
        ;;
   *)
        msg_usage "$0 {start|stop|restart|force-reload|status}"
This page took 0.108553 seconds and 4 git commands to generate.