X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=blobdiff_plain;f=sensors.init;h=80f36dab1c790eccc36b3a852bd13cfc9e4e0866;hb=fe4c9a3412b818aa09911d7d08b3a9b4b3a7701d;hp=bbcd7d565fdb5b34154cccced048400a83947fe5;hpb=ebda79cb11a5858654b6228c019af9157f71ddc0;p=packages%2Flm_sensors.git diff --git a/sensors.init b/sensors.init index bbcd7d5..80f36da 100644 --- a/sensors.init +++ b/sensors.init @@ -2,7 +2,7 @@ # # sensors: Hardware sensors monitoring daemon # -# Version: $Revision$ +# Version: $Revision$ # # chkconfig: 2345 32 68 # description: Starts and stops hardware sensors monitoring daemon. @@ -12,10 +12,11 @@ . /etc/rc.d/init.d/functions # Get service config -if [ -f /etc/sysconfig/sensors ] ; then - . /etc/sysconfig/sensors +if [ -f /etc/sysconfig/sensors ]; then + . /etc/sysconfig/sensors fi +RETVAL=0 # See how we were called. case "$1" in start) @@ -23,10 +24,10 @@ case "$1" in if [ ! -f /var/lock/subsys/sensors ]; then if [ -z "$BUS" ] || [ -z "$CHIP" ]; then msg_starting "sensors daemon"; fail - nls "BUS or CHIP not configured in /etc/sysconfig/sensors" - exit 1 + nls "BUS or CHIP not configured in /etc/sysconfig/sensors" >&2 + exit 6 fi - + # insert modules for i in $BUS; do _modprobe single die "i2c-$i" @@ -38,7 +39,7 @@ case "$1" in if [ "$SENSORS_SET" = "1" ]; then sensors -s fi - + msg_starting "sensors daemon" daemon sensord \ $([ -n "$INTERVAL" ] && echo "-i $INTERVAL") \ @@ -46,20 +47,19 @@ case "$1" in $([ -n "$RRD_LOGFILE" ] && echo "-r $RRD_LOGFILE") \ $([ -n "$RRD_INTERVAL" ] && echo "-t $RRD_INTERVAL") \ -f daemon - - RET=$? - [ $RET -eq 0 ] && touch /var/lock/subsys/sensors + + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensors + touch /var/lock/subsys/sensors else msg_already_running "sensors daemon" - exit 1 fi - touch /var/lock/subsys/sensors ;; stop) if [ -f /var/lock/subsys/sensors ]; then msg_stopping "sensors daemon" killproc sensord - + # remove kernel modules for i in $CHIP; do /sbin/rmmod $i >/dev/null 2>&1 @@ -67,24 +67,25 @@ case "$1" in for i in $BUS; do /sbin/rmmod i2c-$BUS >/dev/null 2>&1 done - + rm -f /var/lock/subsys/sensors else msg_not_running "sensors daemon" - exit 1 fi ;; status) status sensors sensord + RETVAL=$? sensors ;; - restart) + restart|force-reload) $0 stop $0 start + exit $? ;; *) - msg_usage "$0 {start|stop|status|restart}" - exit 1 + msg_usage "$0 {start|stop|restart|force-reload|status}" + exit 3 esac -exit $RET +exit $RETVAL