#!/bin/sh # # alarmwatch watches for lm_sensors alarms # # chkconfig: 2345 32 68 # # description: watches lm_sensors and beeps on aparms # # $Id$ # Source function library . /etc/rc.d/init.d/functions # Set defaults CHIPS="" PIDFILE=/var/run/alarmwatch.pid SENSORS_SETUP=no ALARMOPTIONS="" # Get service config - may override defaults [ -f /etc/sysconfig/alarmwatch ] && . /etc/sysconfig/alarmwatch RETVAL=0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/alarmwatch ]; then if [ -z "$CHIPS" ]; then nls "alarmwatch not configured (CHIPS not set), cannot start." exit 6 fi if [ "$SENSORS_SETUP" = "yes" ]; then # setup sensors limits, etc. sensors -s fi # read from sensors to clear out any alarms caused by previous limits... sensors > /dev/null msg_starting alarmwatch daemon alarmwatch -p "$PIDFILE" $CHIPS $ALARMOPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/alarmwatch else msg_already_running alarmwatch fi ;; stop) # Stop daemons. if [ -f /var/lock/subsys/alarmwatch ]; then msg_stopping alarmwatch killproc alarmwatch rm -f /var/lock/subsys/alarmwatch $PIDFILE else msg_not_running alarmwatch fi ;; restart|force-reload) $0 stop $0 start RETVAL=$? ;; status) status alarmwatch RETVAL=$? ;; *) msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 esac exit $RETVAL # This must be last line ! # vi:syntax=sh:tw=78:ts=8:sw=4