]> git.pld-linux.org Git - packages/lm_sensors.git/blame - sensors.init
- pl for -libs
[packages/lm_sensors.git] / sensors.init
CommitLineData
7ab74234 1#!/bin/sh
2#
3# sensors: Hardware sensors monitoring daemon
4#
3de0a6ab 5# Version: $Revision$
7ab74234 6#
9219070f 7# chkconfig: 2345 32 68
7ab74234 8# description: Starts and stops hardware sensors monitoring daemon.
9# author: Filip Kalinski <filon@pld.org.pl>
10
11# Source function library.
12. /etc/rc.d/init.d/functions
13
14# Get service config
1e5f5b92 15if [ -f /etc/sysconfig/sensors ]; then
3de0a6ab 16 . /etc/sysconfig/sensors
7ab74234 17fi
18
1e5f5b92 19RETVAL=0
7ab74234 20# See how we were called.
21case "$1" in
22 start)
23 # Check if the service is already running?
24 if [ ! -f /var/lock/subsys/sensors ]; then
7ab74234 25 if [ -z "$BUS" ] || [ -z "$CHIP" ]; then
6f93b642 26 msg_starting "sensors daemon"; fail
1e5f5b92 27 nls "BUS or CHIP not configured in /etc/sysconfig/sensors" >&2
28 exit 6
7ab74234 29 fi
3de0a6ab 30
7ab74234 31 # insert modules
ff1b657b
PG
32 for i in $BUS; do
33 _modprobe single die "i2c-$i"
34 done
35 for i in $CHIP; do
36 _modprobe single die "$i"
37 done
09e9890d
JB
38
39 if [ "$SENSORS_SET" = "1" ]; then
40 sensors -s
41 fi
3de0a6ab 42
6f93b642 43 msg_starting "sensors daemon"
7ab74234 44 daemon sensord \
45 $([ -n "$INTERVAL" ] && echo "-i $INTERVAL") \
46 $([ -n "$LOG_INTERVAL" ] && echo "-l $LOG_INTERVAL") \
ebda79cb 47 $([ -n "$RRD_LOGFILE" ] && echo "-r $RRD_LOGFILE") \
48 $([ -n "$RRD_INTERVAL" ] && echo "-t $RRD_INTERVAL") \
7ab74234 49 -f daemon
3de0a6ab 50
51 RETVAL=$?
52 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensors
53 touch /var/lock/subsys/sensors
7ab74234 54 else
eb9828bb 55 msg_already_running "sensors daemon"
7ab74234 56 fi
7ab74234 57 ;;
58 stop)
59 if [ -f /var/lock/subsys/sensors ]; then
60 msg_stopping "sensors daemon"
61 killproc sensord
3de0a6ab 62
7ab74234 63 # remove kernel modules
ff1b657b
PG
64 for i in $CHIP; do
65 /sbin/rmmod $i >/dev/null 2>&1
66 done
67 for i in $BUS; do
68 /sbin/rmmod i2c-$BUS >/dev/null 2>&1
69 done
3de0a6ab 70
7ab74234 71 rm -f /var/lock/subsys/sensors
72 else
eb9828bb 73 msg_not_running "sensors daemon"
7ab74234 74 fi
75 ;;
76 status)
e1086432 77 status sensors sensord
1e5f5b92 78 RETVAL=$?
018b2f95 79 sensors
7ab74234 80 ;;
1e5f5b92 81 restart|force-reload)
7ab74234 82 $0 stop
83 $0 start
3de0a6ab 84 exit $?
85 ;;
7ab74234 86 *)
1e5f5b92 87 msg_usage "$0 {start|stop|restart|force-reload|status}"
88 exit 3
7ab74234 89esac
90
3de0a6ab 91exit $RETVAL
This page took 0.069648 seconds and 4 git commands to generate.