]> git.pld-linux.org Git - packages/lm_sensors.git/commitdiff
initsript for sensors daemon
authorfilon <filon@sokrates.mimuw.edu.pl>
Sun, 20 Jan 2002 20:52:14 +0000 (20:52 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    sensors.init -> 1.1

sensors.init [new file with mode: 0644]

diff --git a/sensors.init b/sensors.init
new file mode 100644 (file)
index 0000000..5c6ec66
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/sh
+#
+# sensors:     Hardware sensors monitoring daemon
+#
+# Version:      $Revision$
+#
+# chkconfig:   2345 30 70
+# description: Starts and stops hardware sensors monitoring daemon.
+# author:      Filip Kalinski <filon@pld.org.pl>
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Get service config
+if [ -f /etc/sysconfig/sensors ] ; then
+        . /etc/sysconfig/sensors
+fi
+
+failed()
+{
+       msg_starting "sensors daemon"
+       fail
+       exit 1
+}
+
+# See how we were called.
+case "$1" in
+  start)
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/sensors ]; then
+               msg_starting "sensors daemon"
+               busy; echo
+
+               # sensors not configured                
+               if [ -z "$BUS" ] || [ -z "$CHIP" ]; then 
+                       failed
+               fi
+               
+               # insert modules
+               _modprobe single die "i2c-$BUS"
+               _modprobe single die "$CHIP"
+
+               msg_starting "sensors daemon"
+               daemon sensord \
+                       $([ -n "$INTERVAL" ] && echo "-i $INTERVAL") \
+                       $([ -n "$LOG_INTERVAL" ] && echo "-l $LOG_INTERVAL") \
+                       -f daemon
+               
+               RET=$?
+               [ $RET -eq 0 ] && touch /var/lock/subsys/sensors
+       else
+               msg_Already_Running "sensors daemon"
+               exit 1
+       fi
+       touch /var/lock/subsys/sensors
+       ;;
+  stop)
+       if [ -f /var/lock/subsys/sensors ]; then
+               msg_stopping "sensors daemon"
+               killproc sensord
+               
+               # remove kernel modules
+               /sbin/rmmod $CHIP >/dev/null 2>&1 
+               /sbin/rmmod i2c-$BUS >/dev/null 2>&1 
+               
+               rm -f /var/lock/subsys/sensors
+       else
+               msg_Not_Running "sensors daemon"
+               exit 1
+       fi
+       ;;
+  status)
+       status sensord
+       ;;
+  restart)
+       $0 stop
+       $0 start
+       ;;
+  *)
+       msg_Usage "$0 {start|stop|status|restart}"
+       exit 1
+esac
+
+exit $RET
This page took 0.073129 seconds and 4 git commands to generate.