3
# healthd -- This is a simple daemon which can be used to alert you in the
4
# event of a hardware health monitoring alarm by sending an
5
# email to the value of ADMIN_EMAIL (defined below).
7
# To Use -- Simply start the daemon from a shell (may be backgrounded)
9
# Other details -- Checks status every 15 seconds. Sends warning emails every
10
# ten minutes during alarm until the alarm is cleared.
11
# It won't start up if there is a pending alarm on startup.
12
# Very low loading on the machine (sleeps almost all the time).
13
# This is just an example. It works, but hopefully we can
14
# get something better written. :')
16
# Requirements -- mail, sensors, bash, sleep
18
# Written & Copyrighten by Philip Edelbrock, 1999.
23
ADMIN_EMAIL="root@localhost"
25
# Try loading the built-in sleep implementation to avoid spawning a
26
# new process every 15 seconds
27
enable -f sleep.so sleep >/dev/null 2>&1
29
sensors_state=$(sensors)
30
if [[ "$sensors_state" =~ 'ALARM' ]]
32
echo "Pending Alarms on start up! Exiting!"
39
sensors_state=$(sensors)
40
if [[ "$sensors_state" =~ 'ALARM' ]]
42
echo "$sensors_state" | mail -s '**** Hardware Health Warning ****' $ADMIN_EMAIL