]> git.pld-linux.org Git - packages/lm_sensors.git/blame_incremental - sensors.init
- pl for -libs
[packages/lm_sensors.git] / sensors.init
... / ...
CommitLineData
1#!/bin/sh
2#
3# sensors: Hardware sensors monitoring daemon
4#
5# Version: $Revision$
6#
7# chkconfig: 2345 32 68
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
15if [ -f /etc/sysconfig/sensors ]; then
16 . /etc/sysconfig/sensors
17fi
18
19RETVAL=0
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
25 if [ -z "$BUS" ] || [ -z "$CHIP" ]; then
26 msg_starting "sensors daemon"; fail
27 nls "BUS or CHIP not configured in /etc/sysconfig/sensors" >&2
28 exit 6
29 fi
30
31 # insert modules
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
38
39 if [ "$SENSORS_SET" = "1" ]; then
40 sensors -s
41 fi
42
43 msg_starting "sensors daemon"
44 daemon sensord \
45 $([ -n "$INTERVAL" ] && echo "-i $INTERVAL") \
46 $([ -n "$LOG_INTERVAL" ] && echo "-l $LOG_INTERVAL") \
47 $([ -n "$RRD_LOGFILE" ] && echo "-r $RRD_LOGFILE") \
48 $([ -n "$RRD_INTERVAL" ] && echo "-t $RRD_INTERVAL") \
49 -f daemon
50
51 RETVAL=$?
52 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensors
53 touch /var/lock/subsys/sensors
54 else
55 msg_already_running "sensors daemon"
56 fi
57 ;;
58 stop)
59 if [ -f /var/lock/subsys/sensors ]; then
60 msg_stopping "sensors daemon"
61 killproc sensord
62
63 # remove kernel modules
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
70
71 rm -f /var/lock/subsys/sensors
72 else
73 msg_not_running "sensors daemon"
74 fi
75 ;;
76 status)
77 status sensors sensord
78 RETVAL=$?
79 sensors
80 ;;
81 restart|force-reload)
82 $0 stop
83 $0 start
84 exit $?
85 ;;
86 *)
87 msg_usage "$0 {start|stop|restart|force-reload|status}"
88 exit 3
89esac
90
91exit $RETVAL
This page took 0.063328 seconds and 4 git commands to generate.