]> git.pld-linux.org Git - packages/lm_sensors.git/blame - sensors.init
- it was closing after klogd, and messing console
[packages/lm_sensors.git] / sensors.init
CommitLineData
7ab74234 1#!/bin/sh
2#
3# sensors: Hardware sensors monitoring daemon
4#
5# Version: $Revision$
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
15if [ -f /etc/sysconfig/sensors ] ; then
16 . /etc/sysconfig/sensors
17fi
18
7ab74234 19# See how we were called.
20case "$1" in
21 start)
22 # Check if the service is already running?
23 if [ ! -f /var/lock/subsys/sensors ]; then
7ab74234 24 if [ -z "$BUS" ] || [ -z "$CHIP" ]; then
11a93cac 25 # sensors not configured
26 exit 1
7ab74234 27 fi
28
29 # insert modules
30 _modprobe single die "i2c-$BUS"
31 _modprobe single die "$CHIP"
09e9890d
JB
32
33 if [ "$SENSORS_SET" = "1" ]; then
34 sensors -s
35 fi
11a93cac 36
7ab74234 37 msg_starting "sensors daemon"
38 daemon sensord \
39 $([ -n "$INTERVAL" ] && echo "-i $INTERVAL") \
40 $([ -n "$LOG_INTERVAL" ] && echo "-l $LOG_INTERVAL") \
41 -f daemon
42
43 RET=$?
44 [ $RET -eq 0 ] && touch /var/lock/subsys/sensors
45 else
46 msg_Already_Running "sensors daemon"
47 exit 1
48 fi
49 touch /var/lock/subsys/sensors
50 ;;
51 stop)
52 if [ -f /var/lock/subsys/sensors ]; then
53 msg_stopping "sensors daemon"
54 killproc sensord
55
56 # remove kernel modules
57 /sbin/rmmod $CHIP >/dev/null 2>&1
58 /sbin/rmmod i2c-$BUS >/dev/null 2>&1
59
60 rm -f /var/lock/subsys/sensors
61 else
62 msg_Not_Running "sensors daemon"
63 exit 1
64 fi
65 ;;
66 status)
67 status sensord
68 ;;
69 restart)
70 $0 stop
71 $0 start
72 ;;
73 *)
74 msg_Usage "$0 {start|stop|status|restart}"
75 exit 1
76esac
77
78exit $RET
This page took 0.0344 seconds and 4 git commands to generate.