]>
Commit | Line | Data |
---|---|---|
7ab74234 | 1 | #!/bin/sh |
2 | # | |
3 | # sensors: Hardware sensors monitoring daemon | |
4 | # | |
3de0a6ab | 5 | # Version: $Revision$ |
7ab74234 | 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 | |
1e5f5b92 | 15 | if [ -f /etc/sysconfig/sensors ]; then |
3de0a6ab | 16 | . /etc/sysconfig/sensors |
7ab74234 | 17 | fi |
18 | ||
1e5f5b92 | 19 | RETVAL=0 |
7ab74234 | 20 | # See how we were called. |
21 | case "$1" in | |
22 | start) | |
ddf897c8 | 23 | if [ ! -f /var/lock/subsys/sensors_modules ]; then |
24 | msg_starting "sensors daemon"; fail | |
25 | nls "sensors_modules services not started" >&2 | |
26 | exit 6 | |
27 | fi | |
28 | ||
7ab74234 | 29 | # Check if the service is already running? |
30 | if [ ! -f /var/lock/subsys/sensors ]; then | |
6f93b642 | 31 | msg_starting "sensors daemon" |
7ab74234 | 32 | daemon sensord \ |
33 | $([ -n "$INTERVAL" ] && echo "-i $INTERVAL") \ | |
34 | $([ -n "$LOG_INTERVAL" ] && echo "-l $LOG_INTERVAL") \ | |
ebda79cb | 35 | $([ -n "$RRD_LOGFILE" ] && echo "-r $RRD_LOGFILE") \ |
36 | $([ -n "$RRD_INTERVAL" ] && echo "-t $RRD_INTERVAL") \ | |
7ab74234 | 37 | -f daemon |
3de0a6ab | 38 | |
39 | RETVAL=$? | |
40 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensors | |
41 | touch /var/lock/subsys/sensors | |
7ab74234 | 42 | else |
eb9828bb | 43 | msg_already_running "sensors daemon" |
7ab74234 | 44 | fi |
7ab74234 | 45 | ;; |
46 | stop) | |
47 | if [ -f /var/lock/subsys/sensors ]; then | |
48 | msg_stopping "sensors daemon" | |
49 | killproc sensord | |
7ab74234 | 50 | rm -f /var/lock/subsys/sensors |
51 | else | |
eb9828bb | 52 | msg_not_running "sensors daemon" |
7ab74234 | 53 | fi |
54 | ;; | |
55 | status) | |
e1086432 | 56 | status sensors sensord |
1e5f5b92 | 57 | RETVAL=$? |
018b2f95 | 58 | sensors |
7ab74234 | 59 | ;; |
1e5f5b92 | 60 | restart|force-reload) |
7ab74234 | 61 | $0 stop |
62 | $0 start | |
3de0a6ab | 63 | exit $? |
64 | ;; | |
7ab74234 | 65 | *) |
1e5f5b92 | 66 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
67 | exit 3 | |
7ab74234 | 68 | esac |
69 | ||
3de0a6ab | 70 | exit $RETVAL |