]> git.pld-linux.org Git - packages/lm_sensors.git/blob - sensors.init
a0da890c0d2b7a5676d006b325f512696fba7c00
[packages/lm_sensors.git] / sensors.init
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
15 if [ -f /etc/sysconfig/sensors ]; then
16         . /etc/sysconfig/sensors
17 fi
18
19 start() {
20         if [ ! -f /var/lock/subsys/sensors_modules ]; then
21                 msg_starting "sensors daemon"; fail
22                 nls "sensors_modules services not started"
23                 exit 6
24         fi
25         
26         # Check if the service is already running?
27         if [ ! -f /var/lock/subsys/sensors ]; then
28                 msg_starting "sensors daemon"
29                 daemon sensord \
30                         ${INTERVAL:+-i $INTERVAL} \
31                         ${LOG_INTERVAL:+-l $LOG_INTERVAL} \
32                         ${RRD_LOGFILE:+-r $RRD_LOGFILE} \
33                         ${RRD_INTERVAL:+-t $RRD_INTERVAL} \
34                         -f daemon
35
36                 RETVAL=$?
37                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensors
38                 touch /var/lock/subsys/sensors
39         else
40                 msg_already_running "sensors daemon"
41         fi
42 }
43
44 stop() {
45         if [ -f /var/lock/subsys/sensors ]; then
46                 msg_stopping "sensors daemon"
47                 killproc sensord
48                 rm -f /var/lock/subsys/sensors
49         else
50                 msg_not_running "sensors daemon"
51         fi
52 }
53
54 RETVAL=0
55 # See how we were called.
56 case "$1" in
57   start)
58         start
59         ;;
60   stop)
61         stop
62         ;;
63   status)
64         status sensors sensord
65         RETVAL=$?
66         sensors
67         ;;
68   restart|force-reload)
69         stop
70         start
71         ;;
72   *)
73         msg_usage "$0 {start|stop|restart|force-reload|status}"
74         exit 3
75 esac
76
77 exit $RETVAL
This page took 0.214974 seconds and 2 git commands to generate.