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