--- /dev/null
+#!/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
+
+# 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
+ echo "alarmwatch not configured (CHIPS not set), cannot start."
+ exit 1
+ 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
+
+ # show "Starting %s service" <service>
+ msg_starting alarmwatch
+ daemon alarmwatch -p "$PIDFILE" $CHIPS $ALARMOPTIONS
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/alarmwatch
+ else
+ # show "%s service is already running." <service>
+ msg_already_running alarmwatch
+ exit 1
+ fi
+ ;;
+ stop)
+ # Stop daemons.
+ # show "Stopping %s service" <service>
+ if [ -f /var/lock/subsys/alarmwatch ]; then
+ msg_stopping alarmwatch
+ killproc alarmwatch
+ RETVAL=$?
+ rm -f /var/lock/subsys/alarmwatch $PIDFILE
+ else
+ # show "%s service is not running." <service>
+ msg_not_running alarmwatch
+ exit 1
+ fi
+ ;;
+ restart|reload|force-reload)
+ $0 stop
+ $0 start
+ ;;
+ status)
+ status alarmwatch
+ RETVAL=$?
+ ;;
+ *)
+ # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0
+ msg_usage "$0 {start|stop|status|restart|reload|force-reload}"
+ exit 1
+esac
+
+exit $RETVAL
+
+# This must be last line !
+# vi:syntax=sh:tw=78:ts=8:sw=4
--- /dev/null
+Summary: Daemon that watches lm_sensors and beeps on alarms
+Summary(pl): Demon kontroluj±cy stan lm_sensors i piszczacy podczas alarmów
+Name: alarmwatch
+Version: 1.0
+Release: 1
+License: GPL
+Group: Daemons
+Source0: http://www.azstarnet.com/~donut/programs/alarmwatch/%{name}-%{version}.tar.gz
+Source1: %{name}.init
+Source2: %{name}.sysconfig
+URL: http://www.azstarnet.com/~donut/programs/alarmwatch.html
+BuildRequires: autoconf
+PreReq: rc-scripts
+Requires(post,preun): /sbin/chkconfig
+Requires: lm_sensors
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+alarmwatch watches the lm_sensors /proc filesystem for the chips you
+specify, and alerts you by beeping and syslog messages when an alarm
+that is not ignored is active.
+
+%description -l pl
+alarmwatch kontroluje stan wybranych uk³adów poprzez lm_sensors w
+systemie plików /proc i ostrzega piskami oraz komunikatami w logach,
+kiedy nie ignorowany alarm jest aktywny.
+
+%prep
+%setup -q
+
+%build
+autoconf
+%configure
+
+%{__make}
+
+gzip -9nf README Changelog
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man8} \
+ $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
+
+install alarmwatch $RPM_BUILD_ROOT%{_sbindir}
+sed -e 's@alarmwatch 1@alarmwatch 8@' alarmwatch.1 \
+ > $RPM_BUILD_ROOT%{_mandir}/man8/alarmwatch.8
+
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/alarmwatch
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/alarmwatch
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+/sbin/chkconfig --add alarmwatch
+if [ -f /var/lock/subsys/alarmwatch ]; then
+ /etc/rc.d/init.d/gpm alarmwatch >&2
+else
+ echo "Run \"/etc/rc.d/init.d/alarmwatch start\" to start alarmwatch daemon."
+ echo "Remember to configure it first!"
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+ if [ -f /var/lock/subsys/alarmwatch ]; then
+ /etc/rc.d/init.d/alarmwatch stop >&2
+ fi
+ /sbin/chkconfig --del alarmwatch
+fi
+
+%files
+%defattr(644,root,root,755)
+%doc *.gz
+%attr(755,root,root) %{_sbindir}/*
+%{_mandir}/man8/*
+%attr(754,root,root) /etc/rc.d/init.d/alarmwatch
+%config(noreplace) %verify(not size mtime md5) /etc/sysconfig/alarmwatch
--- /dev/null
+# configuration for alarmwatch
+#
+# To enable alarmwatch automatic startup, set the CHIPS line to your
+# desired command line(see `man alarmwatch') and remove the exit 0
+
+# Example only, you _must_ edit this to match your configuration:
+#CHIPS="via686a-isa-6000 512"
+
+# Initialize sensors settings before loading alarmwatch. (`sensors -s')
+# You may wish to set this to no if you already do it elsewhere (though
+# doing it again will not harm anything.)
+#SENSORS_SETUP=yes
+
+# alarmwatch options (see alarmwatch(8) for details):
+# -C sec - check interval
+# -B sec - beep interval
+# -L sec - log interval
+# -b dev - filename to send beeps to
+#ALARMOPTIONS="-C5 -B30 -L60 -b/dev/console"