]> git.pld-linux.org Git - packages/lm_sensors.git/blame - sensors_modules.init
- updated for 3.0.1
[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
0d0caf19 9
10# Source function library.
11. /etc/rc.d/init.d/functions
12
13# Get service config
14if [ -f /etc/sysconfig/sensors_modules ]; then
15 . /etc/sysconfig/sensors_modules
16fi
17
4425df33 18start() {
0d0caf19 19 # Check if the service is already running?
20 if [ ! -f /var/lock/subsys/sensors_modules ]; then
d7acec9a 21 if [ -z "$BUS" ] && [ -z "$CHIP" ]; then
0d0caf19 22 msg_starting "sensors modules"; fail
23 nls "BUS or CHIP not configured in /etc/sysconfig/sensors_modules" >&2
24 exit 6
25 fi
26
27 # insert modules
28 for i in $BUS; do
29 _modprobe single die "i2c-$i"
30 done
31 for i in $CHIP; do
32 _modprobe single die "$i"
33 done
34
35 if [ "$SENSORS_SET" = "1" ]; then
36 sensors -s
37 fi
38 touch /var/lock/subsys/sensors_modules
39 else
40 msg_already_running "sensors modules"
41 fi
4425df33
ER
42}
43
44stop() {
0d0caf19 45 if [ -f /var/lock/subsys/sensors_modules ]; then
46 msg_stopping "sensors modules"
47
48 # remove kernel modules
49 for i in $CHIP; do
50 /sbin/rmmod $i >/dev/null 2>&1
51 done
52 for i in $BUS; do
53 /sbin/rmmod i2c-$BUS >/dev/null 2>&1
54 done
55 ok
56 rm -f /var/lock/subsys/sensors_modules
57 else
58 msg_not_running "sensors modules"
59 fi
4425df33
ER
60}
61
62RETVAL=0
63# See how we were called.
64case "$1" in
65 start)
66 start
67 ;;
68 stop)
69 stop
0d0caf19 70 ;;
71 status)
72 sensors
73 ;;
74 restart|force-reload)
4425df33
ER
75 stop
76 start
0d0caf19 77 ;;
78 *)
79 msg_usage "$0 {start|stop|restart|force-reload|status}"
80 exit 3
81esac
82
83exit $RETVAL
This page took 0.059839 seconds and 4 git commands to generate.