]> git.pld-linux.org Git - packages/lm_sensors.git/blame - sensors_modules.init
- initial revision
[packages/lm_sensors.git] / sensors_modules.init
CommitLineData
0d0caf19 1#!/bin/sh
2#
3# sensors_modules: Hardware sensors monitoring
4#
5# Version: $Revision$
6#
7# chkconfig: 2345 31 69
8# description: Loads and removes hardware sensors modules
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_modules ]; then
16 . /etc/sysconfig/sensors_modules
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_modules ]; then
25 if [ -z "$BUS" ] || [ -z "$CHIP" ]; then
26 msg_starting "sensors modules"; fail
27 nls "BUS or CHIP not configured in /etc/sysconfig/sensors_modules" >&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 touch /var/lock/subsys/sensors_modules
43 else
44 msg_already_running "sensors modules"
45 fi
46 ;;
47 stop)
48 if [ -f /var/lock/subsys/sensors_modules ]; then
49 msg_stopping "sensors modules"
50
51 # remove kernel modules
52 for i in $CHIP; do
53 /sbin/rmmod $i >/dev/null 2>&1
54 done
55 for i in $BUS; do
56 /sbin/rmmod i2c-$BUS >/dev/null 2>&1
57 done
58 ok
59 rm -f /var/lock/subsys/sensors_modules
60 else
61 msg_not_running "sensors modules"
62 fi
63 ;;
64 status)
65 sensors
66 ;;
67 restart|force-reload)
68 $0 stop
69 $0 start
70 exit $?
71 ;;
72 *)
73 msg_usage "$0 {start|stop|restart|force-reload|status}"
74 exit 3
75esac
76
77exit $RETVAL
This page took 0.047567 seconds and 4 git commands to generate.